From 682337d7cef2b8b0dea74e1a3fb07c3739b88319 Mon Sep 17 00:00:00 2001 From: "andy.boot" Date: Tue, 21 Nov 2023 20:57:20 +0000 Subject: [PATCH] doesn't quite work yet --- completions/_dust | 2 ++ completions/_dust.ps1 | 2 ++ completions/dust.bash | 2 +- completions/dust.elv | 2 ++ completions/dust.fish | 1 + man-page/dust.1 | 5 ++++- src/cli.rs | 6 ++++++ tests/test_exact_output.rs | 9 +++++---- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/completions/_dust b/completions/_dust index c15e06e4..f2010706 100644 --- a/completions/_dust +++ b/completions/_dust @@ -47,6 +47,8 @@ _dust() { '--no-colors[No colors will be printed (Useful for commands like: watch)]' \ '-b[No percent bars or percentages will be displayed]' \ '--no-percent-bars[No percent bars or percentages will be displayed]' \ +'-B[percent bars moved to right side of screen]' \ +'--bars-on-right[percent bars moved to right side of screen]' \ '-R[For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)]' \ '--screen-reader[For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)]' \ '--skip-total[No total row will be displayed]' \ diff --git a/completions/_dust.ps1 b/completions/_dust.ps1 index 865ee384..0f4ffa8c 100644 --- a/completions/_dust.ps1 +++ b/completions/_dust.ps1 @@ -53,6 +53,8 @@ Register-ArgumentCompleter -Native -CommandName 'dust' -ScriptBlock { [CompletionResult]::new('--no-colors', 'no-colors', [CompletionResultType]::ParameterName, 'No colors will be printed (Useful for commands like: watch)') [CompletionResult]::new('-b', 'b', [CompletionResultType]::ParameterName, 'No percent bars or percentages will be displayed') [CompletionResult]::new('--no-percent-bars', 'no-percent-bars', [CompletionResultType]::ParameterName, 'No percent bars or percentages will be displayed') + [CompletionResult]::new('-B', 'B', [CompletionResultType]::ParameterName, 'percent bars moved to right side of screen') + [CompletionResult]::new('--bars-on-right', 'bars-on-right', [CompletionResultType]::ParameterName, 'percent bars moved to right side of screen') [CompletionResult]::new('-R', 'R', [CompletionResultType]::ParameterName, 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)') [CompletionResult]::new('--screen-reader', 'screen-reader', [CompletionResultType]::ParameterName, 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)') [CompletionResult]::new('--skip-total', 'skip-total', [CompletionResultType]::ParameterName, 'No total row will be displayed') diff --git a/completions/dust.bash b/completions/dust.bash index 83d7b65a..816ce76d 100644 --- a/completions/dust.bash +++ b/completions/dust.bash @@ -19,7 +19,7 @@ _dust() { case "${cmd}" in dust) - opts="-h -V -d -n -p -X -L -x -s -r -c -b -z -R -f -i -v -e -t -w -H -P -D -F --help --version --depth --number-of-lines --full-paths --ignore-directory --dereference-links --limit-filesystem --apparent-size --reverse --no-colors --no-percent-bars --min-size --screen-reader --skip-total --filecount --ignore_hidden --invert-filter --filter --file_types --terminal_width --si --no-progress --only-dir --only-file ..." + opts="-h -V -d -n -p -X -L -x -s -r -c -b -B -z -R -f -i -v -e -t -w -H -P -D -F --help --version --depth --number-of-lines --full-paths --ignore-directory --dereference-links --limit-filesystem --apparent-size --reverse --no-colors --no-percent-bars --bars-on-right --min-size --screen-reader --skip-total --filecount --ignore_hidden --invert-filter --filter --file_types --terminal_width --si --no-progress --only-dir --only-file ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 diff --git a/completions/dust.elv b/completions/dust.elv index af7ccb37..7b835e78 100644 --- a/completions/dust.elv +++ b/completions/dust.elv @@ -50,6 +50,8 @@ set edit:completion:arg-completer[dust] = {|@words| cand --no-colors 'No colors will be printed (Useful for commands like: watch)' cand -b 'No percent bars or percentages will be displayed' cand --no-percent-bars 'No percent bars or percentages will be displayed' + cand -B 'percent bars moved to right side of screen' + cand --bars-on-right 'percent bars moved to right side of screen' cand -R 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)' cand --screen-reader 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)' cand --skip-total 'No total row will be displayed' diff --git a/completions/dust.fish b/completions/dust.fish index b08ec960..957b5033 100644 --- a/completions/dust.fish +++ b/completions/dust.fish @@ -14,6 +14,7 @@ complete -c dust -s s -l apparent-size -d 'Use file length instead of blocks' complete -c dust -s r -l reverse -d 'Print tree upside down (biggest highest)' complete -c dust -s c -l no-colors -d 'No colors will be printed (Useful for commands like: watch)' complete -c dust -s b -l no-percent-bars -d 'No percent bars or percentages will be displayed' +complete -c dust -s B -l bars-on-right -d 'percent bars moved to right side of screen' complete -c dust -s R -l screen-reader -d 'For screen readers. Removes bars. Adds new column: depth level (May want to use -p too for full path)' complete -c dust -l skip-total -d 'No total row will be displayed' complete -c dust -s f -l filecount -d 'Directory \'size\' is number of child files instead of disk size' diff --git a/man-page/dust.1 b/man-page/dust.1 index 86db4d19..8d9219b6 100644 --- a/man-page/dust.1 +++ b/man-page/dust.1 @@ -4,7 +4,7 @@ .SH NAME Dust \- Like du but more intuitive .SH SYNOPSIS -\fBDust\fR [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-d\fR|\fB\-\-depth\fR] [\fB\-n\fR|\fB\-\-number\-of\-lines\fR] [\fB\-p\fR|\fB\-\-full\-paths\fR] [\fB\-X\fR|\fB\-\-ignore\-directory\fR] [\fB\-L\fR|\fB\-\-dereference\-links\fR] [\fB\-x\fR|\fB\-\-limit\-filesystem\fR] [\fB\-s\fR|\fB\-\-apparent\-size\fR] [\fB\-r\fR|\fB\-\-reverse\fR] [\fB\-c\fR|\fB\-\-no\-colors\fR] [\fB\-b\fR|\fB\-\-no\-percent\-bars\fR] [\fB\-z\fR|\fB\-\-min\-size\fR] [\fB\-R\fR|\fB\-\-screen\-reader\fR] [\fB\-\-skip\-total\fR] [\fB\-f\fR|\fB\-\-filecount\fR] [\fB\-i\fR|\fB\-\-ignore_hidden\fR] [\fB\-v\fR|\fB\-\-invert\-filter\fR] [\fB\-e\fR|\fB\-\-filter\fR] [\fB\-t\fR|\fB\-\-file_types\fR] [\fB\-w\fR|\fB\-\-terminal_width\fR] [\fB\-H\fR|\fB\-\-si\fR] [\fB\-P\fR|\fB\-\-no\-progress\fR] [\fB\-D\fR|\fB\-\-only\-dir\fR] [\fB\-F\fR|\fB\-\-only\-file\fR] [\fIinputs\fR] +\fBDust\fR [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-d\fR|\fB\-\-depth\fR] [\fB\-n\fR|\fB\-\-number\-of\-lines\fR] [\fB\-p\fR|\fB\-\-full\-paths\fR] [\fB\-X\fR|\fB\-\-ignore\-directory\fR] [\fB\-L\fR|\fB\-\-dereference\-links\fR] [\fB\-x\fR|\fB\-\-limit\-filesystem\fR] [\fB\-s\fR|\fB\-\-apparent\-size\fR] [\fB\-r\fR|\fB\-\-reverse\fR] [\fB\-c\fR|\fB\-\-no\-colors\fR] [\fB\-b\fR|\fB\-\-no\-percent\-bars\fR] [\fB\-B\fR|\fB\-\-bars\-on\-right\fR] [\fB\-z\fR|\fB\-\-min\-size\fR] [\fB\-R\fR|\fB\-\-screen\-reader\fR] [\fB\-\-skip\-total\fR] [\fB\-f\fR|\fB\-\-filecount\fR] [\fB\-i\fR|\fB\-\-ignore_hidden\fR] [\fB\-v\fR|\fB\-\-invert\-filter\fR] [\fB\-e\fR|\fB\-\-filter\fR] [\fB\-t\fR|\fB\-\-file_types\fR] [\fB\-w\fR|\fB\-\-terminal_width\fR] [\fB\-H\fR|\fB\-\-si\fR] [\fB\-P\fR|\fB\-\-no\-progress\fR] [\fB\-D\fR|\fB\-\-only\-dir\fR] [\fB\-F\fR|\fB\-\-only\-file\fR] [\fIinputs\fR] .SH DESCRIPTION Like du but more intuitive .SH OPTIONS @@ -45,6 +45,9 @@ No colors will be printed (Useful for commands like: watch) \fB\-b\fR, \fB\-\-no\-percent\-bars\fR No percent bars or percentages will be displayed .TP +\fB\-B\fR, \fB\-\-bars\-on\-right\fR +percent bars moved to right side of screen +.TP \fB\-z\fR, \fB\-\-min\-size\fR Minimum size file to include in output .TP diff --git a/src/cli.rs b/src/cli.rs index 2f8d6f7f..4b7ede4e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -73,6 +73,12 @@ pub fn build_cli() -> Command<'static> { .long("no-percent-bars") .help("No percent bars or percentages will be displayed"), ) + .arg( + Arg::new("bars_on_right") + .short('B') + .long("bars-on-right") + .help("percent bars moved to right side of screen"), + ) .arg( Arg::new("min_size") .short('z') diff --git a/tests/test_exact_output.rs b/tests/test_exact_output.rs index 4302c0b6..2c3e7ec9 100644 --- a/tests/test_exact_output.rs +++ b/tests/test_exact_output.rs @@ -60,7 +60,7 @@ fn exact_output_test>(valid_outputs: Vec, command_args: #[test] pub fn test_main_basic() { // -c is no color mode - This makes testing much simpler - exact_output_test(main_output(), vec!["-c", "/tmp/test_dir/"]) + exact_output_test(main_output(), vec!["-c", "-B", "/tmp/test_dir/"]) } #[cfg_attr(target_os = "windows", ignore)] @@ -68,6 +68,7 @@ pub fn test_main_basic() { pub fn test_main_multi_arg() { let command_args = vec![ "-c", + "-B", "/tmp/test_dir/many/", "/tmp/test_dir", "/tmp/test_dir", @@ -102,7 +103,7 @@ fn main_output() -> Vec { #[cfg_attr(target_os = "windows", ignore)] #[test] pub fn test_main_long_paths() { - let command_args = vec!["-c", "-p", "/tmp/test_dir/"]; + let command_args = vec!["-c", "-p", "-B", "/tmp/test_dir/"]; exact_output_test(main_output_long_paths(), command_args); } @@ -130,7 +131,7 @@ fn main_output_long_paths() -> Vec { #[cfg_attr(target_os = "windows", ignore)] #[test] pub fn test_substring_of_names_and_long_names() { - let command_args = vec!["-c", "/tmp/test_dir2"]; + let command_args = vec!["-c", "-B","/tmp/test_dir2"]; exact_output_test(no_substring_of_names_output(), command_args); } @@ -164,7 +165,7 @@ fn no_substring_of_names_output() -> Vec { #[cfg_attr(target_os = "windows", ignore)] #[test] pub fn test_unicode_directories() { - let command_args = vec!["-c", "/tmp/test_dir_unicode"]; + let command_args = vec!["-c", "-B","/tmp/test_dir_unicode"]; exact_output_test(unicode_dir(), command_args); }