Read NUL- or newline-terminated paths from FILE or stdin.
Wire options through `config` and `main`. Add tests and update the
man page, README, and completion scripts.
If we run `dust /usr/*/Trash`
We see several 'Trash' directories in the output but do not know which
user they belong to.
This fix means if we see duplicate names in a directory we will display
the parent directory name as well
my 'many' line is: 4.0K ┌─┴ many │ the characters 4.0K are 4 chars.
photosheep's space for 'many' is '44B' which is 3 chars and so my system
needs 1 more char. Hence there is one more space character padding
floating round.
Provide "No such file or directory" error if file is not found.
Provide "Unknown Error" if other error found
Should reduce confusion from the generic other error
- If `--depth` flag is not defined (or it has an invalid value), a value
from the config file will be used.
- If no `depth` entry in the config file (or there is no config file),
the default `usize::MAX` will be used.
Added test cases:
- no config and no flag defined -> `usize::MAX` should be used
- config defined, but flag is not defined -> config value should be used
- config is not defined, but flag is defined -> flag value should be used
- both config and flag is defined -> flag value should be used
Additional changes:
- Fixed some clippy issues.
- Added comments to the example `config.toml` file.
(copy from flag description)
Closes: #314
Signed-off-by: Balazs Nadasdi <efertone@pm.me>
* v1.0
* renamed operations to be more clear
* put info later because there is still operations par of the preparing process
* updated the last line clearing
* changed name of module and structs to ones that make more sens
* Disable size computation when file_count option is set
* added sleep during the thread waiting
* use 1024 powered instead of 10 to compute showed number
* include DS_Store
* added files directories skipped information
* small format update
* implement the -H option
* put wait back
* remove PAtomicInfo since it's not used
* cargo fmt
* wrapped atomic operations to reduce overhead
* updated comments
* Use AtomicU64Wrapper instead of AtomicU64 in TotalSize
* update size suffix
* sto dividing size when larger than terabytes
* Fix use_iso flag not be set properly
* update properties display
* some reformating
* use stdout instead of print
* Moved config instance into main because it's easier to read
* merge base formatting into macro
* update name to be more intuitive and separated math operations for more flexibility
* print currently indexed path
* cargo fmt
* reset size between each target dirs
* Access to TotalSize rather than it's inner
* small comment change
* Update sysinfo version to 0.26.7
* fix: update use of sysinfo.system
System is now much quicker to start but requires an explicit call
to refresh memory else it deafults to 0 (oops)
* clippy: Fix new clippy
* fix: bug where hard links could be double counted
When running:
dust dir_a dir_b
if a file was hard linked in both dir_a and dir_b it would be double
counted.
This fix resolves this by keeping the shared hashmap around between runs
for the second and subsequent arguments.
https://github.com/bootandy/dust/issues/282
* Fix: depth=0 bug for multiple arguments
https://github.com/bootandy/dust/issues/282
* refactor filter.rs
* refactor filter.rs
* refactor create AggregateData for filter.rs
* feature: Support for dereference links -L follow
du has -L flag which allows it to dereference or follow
symlinks. Clone this feature into dust.
https://github.com/bootandy/dust/issues/276
* refactor dir_walker
I find this layout cleaner
* v1.0
* changed name of module and structs to ones that make more sens
* Disable size computation when file_count option is set
* added files directories skipped information
* implement the -H option
* wrapped atomic operations to reduce overhead
* used human_readable_number function in display module rather than our own
* implemented progress disabling
* cargo fmt & cargo clippy
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
Co-authored-by: andy.boot <bootandy@gmail.com>
When running:
dust dir_a dir_b
if a file was hard linked in both dir_a and dir_b it would be double
counted.
This fix resolves this by keeping the shared hashmap around between runs
for the second and subsequent arguments.
https://github.com/bootandy/dust/issues/282
- Try to use iterator adapters and collect in various places, where possible. This especially benefits draw_it.
- Try to use `.map` and other similar methods on Options and Results, where possible
- Replaced nearly all clones with reference-based equivalents
- Summarizing nodes by file extension is now much more efficient
- PartialOrd and PartialEq implementations now agree
- Replace #[cfg(...)] function definitions with simpler if cfg!(...) equivelents
- Simplify CLI Values handling by taking advantage of Values::default
- Various spelling corrections in comments
- Add `ColorState` enum to replace bool, for clarity
- Fix tests that break under some detected terminal widths when paths are long
- Use sort_by instead of (sort, reverse)
- Use new `ExtensionNode` struct internally to simplify extension aggregation code
Before we assumed 5 chars for printing the size of a node. This change
allows us to check if we need 5 chars or if we can manage with 4 which
may save us a character.
(1023B = 5 chars, 1.2K = 4 chars)
Note: Mac test runners create very long filenames in tmp directories. To
fix this we must either
1) Tell the terminal it has a very wide width
2) Duplicate the code to reduce the size of the filename (add .. at the
end).
This commit changes from (2) to (1)
Now files are iterated thru in a preditermined order we can tighten the
boundaries of the test_hard_sym_link test.
Link will not be displayed, only the file name
The code calculating the width of a row to use vs the width of the
terminal wasn't quite right.
If we had 2 long filepaths one at the top of the dir tree and one at the
bottom the old code would shorten both equally. This doesn't make sense
as the one at the shallowest part of the tree would have used less
screen real estate and so should show a longer part of the filepath.
For some unknown reason mac takes offence to searching for
'test_dir_unicode'. 'test_dir_hidden' seems to work fine.
This isn't a proper fix as I've just hacked round the problem. Ideally
I'd need a mac user to do some investigation.
Because apparent_size uses the test files created in /tmp it needs to be
in the test_exact_output where those files are copied. Otherwise the files
may not be there when the test is run.
-t = Show summary of types
-e = Filter by regex
allows you to specify a file type like -e "\.txt$"
Change behaviour of '-f' flag - it now counts only files. Before it
counted files & directories. This was needed for compatibility with
the new '-e' filter flag
Move apparent size test to 'test_flags' file. We can no longer test the
exact output of this test as it changes too much on different filesystems
Move common code to shared initialization function in test_flags.rs
Code changes:
Removed ignore & channel crates. Using a single reciever thread to build
a hashmap to prevend duplicate inodes being reported gave a severe
performance penalty
Using rayon crate with some hand crafted file traversal has improved
performance aprox 10X
Behaviour changes:
Removed parameter 'limit by filesystem' - don't think this is used, and
I only added it as it was easy to add with the ignore crate.
Sym links will now not appear in the output tree unless using '-s'
'apparent-size' flag
Change behaviour of multiple args so that it unifies them and
compares them under one tree instead of treating them
individually: https://github.com/bootandy/dust/issues/136