Because I'm not familiar with Rust, when I was working on
https://github.com/bootandy/dust/pull/390 I didn't realize that the
completions were auto-generated via clap. I'm sorry. This redoes it
with clap.
This improves not only the completions but also the --help and the
man page. Also the --output-format flag will raise an error if the
given value is invalid.
Currently options following regular arguments are not interpreted as
options. This fixes that.
Users can still treat values starting with a hyphen (`-`) as regular
arguments by using `--`, e.g.:
dust -d 2 -r ~/Documents -F -- --this-is-my-dir
add new option: --output-format this controls how the output is
summarised and takes:
nothing = default behaviour
si = SI units (same as old --si flag)
b = bytes
kb = kb
kib = si kb
mb = mb
mib = si mb
....etc
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 a user reports a crash from stacksize - we can try different stack
memory sizes to try and figure out the cause.
Do not try and initialise rayon on 32 bit builds
Fix rayon initialisation, may not have been called before due to badly
formed closure
- 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>
Pull out display code into different functions
Experimented with printing the actual directory currently being parsed
but this resulted into too many flickering hard to follow prints. It's
cleaner to just print the target directory rather than the directory
currently being examined by the dir_walker.