Commit Graph

28 Commits

Author SHA1 Message Date
Junghyeon Park
7974e2eaf0 feat: support --files-from/--files0-from
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.
2025-10-06 20:11:01 +01:00
andy.boot
901bc3895a feat: Return 1 if no dirs are found
A better error code
2025-07-31 22:33:44 +01:00
andy.boot
3cce61f854 tests: add test for d0
Test to stop bug in previous commit occuring
Also cargo clippy
2025-07-28 22:35:40 +01:00
andy.boot
9a49221ac1 fix: status mesages go to stderr not stdout (#483)
Progress spinner and status line are written to stderr
instead of stdout.

No longer any need to detect if stdout is being redirected.
2025-04-01 23:19:36 +01:00
andy.boot
137e366eca feat: Handle duplicate dir names better
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
2025-02-20 22:08:06 +00:00
andy.boot
01c0aaeade feat: New --collapse flag
--collapse will keep that directory collapsed and will not expand it.
2025-01-27 22:00:08 +00:00
andy.boot
cab250aa0e tests: Fix test broken in prev commit 2024-06-18 23:43:58 +01:00
andy.boot
5b87260467 feat: Adding threads flag
Thanks: Dj-Codeman
2024-05-06 20:26:02 +01:00
n4n5
fbd34ec4c2 Better handling for color in terminal (#381)
* better handling for color in terminal

* cleanup

* cleanup

* cargo fmt

* clippy + tests

* clean
2024-03-25 21:50:29 +00:00
andy.boot
e80892a9e7 feat: better error messages
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
2024-01-09 23:02:01 +00:00
andy.boot
cd53fc7494 feat: new param: ignore-all-in-file
Add new cmd line param to ignore all files or directories listed in this
file
2024-01-03 22:24:23 +00:00
Efertone
2f7c197cd7 feat: default option for depth from config file
- 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>
2023-03-06 21:43:15 +00:00
andy.boot
184d1ec5e8 Feature: Add flag for screen readers
Screen reader mode will,
Reverse direction
Not shows symbols (directory hierarchy or percentage bars)
Adds a column 'depth' to show depth of directory
2023-01-29 09:52:10 +00:00
andy.boot
1495251ebc feature: --files-only -F
Add feature to only show files skipping directories.
2023-01-29 09:34:40 +00:00
andy.boot
5e607cf210 Fix: depth=0 bug for multiple arguments
https://github.com/bootandy/dust/issues/282
2023-01-05 09:22:38 +00:00
Nathan West
c36ca33fe9 Lots of code cleanup
- 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
2022-08-20 10:50:46 +01:00
andy.boot
34ba99af2a Tests: Check stderr is empty in test_flags
For each test_flag test using the build_command helper method, check
that stderr is empty
2022-08-19 10:43:24 +01:00
andy.boot
b62f35291d Fix: Remove first space char
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)
2022-08-19 10:41:59 +01:00
andy.boot
a7120b949c Tests: Add test to verify skip-total flag 2022-08-18 15:22:10 +01:00
andy.boot
2749f56b7a Tests: Fix test on mac (hack)
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.
2021-11-20 12:05:48 +00:00
andy.boot
4b3dc3988d Tests: Move test apparent size to exact_output
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.
2021-10-24 14:05:14 +01:00
andy.boot
abb08f8e1a Tests: Add tests for multi regex support 2021-10-24 14:05:14 +01:00
andy.boot
9d2e6d2b36 Feature: Filter by invert_filter: reverse match
Mimic grep's -v option.

Allows dust to only match files that do not match the given filter
2021-09-19 11:12:23 +01:00
andy.boot
124c19b5c9 Feature: Adding file types filter & F flag changed
-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
2021-09-19 11:12:23 +01:00
andy.boot
ca0a93f222 Tests: Refactor
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
2021-08-06 11:07:48 +01:00
andy.boot
00c7ce8f15 Large refactor. Use rayon, 10X performance boost
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
2021-06-22 12:20:48 +01:00
andy.boot
1d018bc80b Add test to check behaviour of -d flag
Covers the case fixed by the previous commit
2020-09-03 22:17:39 +01:00
andy.boot
b643abe05e Refactor tests.
Split tests up into 2 files, 'exact output match' and 'substring ouput
match'
2020-09-03 00:04:27 +01:00