Skip to content

Commit 3e05eea

Browse files
committed
feat: improve shell completions
1 parent b0448ef commit 3e05eea

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ assert-cmp = "^0.2.1"
6060
zero-copy-pads = "^0.2.0"
6161
terminal_size = "^0.4.0"
6262
clap = { version = "^4.3.8", optional = true }
63-
clap_complete = { version = "^4.1.3", optional = true }
63+
clap_complete = { version = "^4.5.36", optional = true }
6464
clap-utilities = { version = "^0.2.0", optional = true }
6565
serde = { version = "^1.0.214", optional = true }
6666
serde_json = { version = "^1.0.132", optional = true }

exports/completion.fish

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
complete -c pdu -l bytes-format -d 'How to display the numbers of bytes' -r -f -a "{plain 'Display plain number of bytes without units',metric 'Use metric scale, i.e. 1K = 1000B, 1M = 1000K, and so on',binary 'Use binary scale, i.e. 1K = 1024B, 1M = 1024K, and so on'}"
2-
complete -c pdu -l quantity -d 'Aspect of the files/directories to be measured' -r -f -a "{apparent-size 'Measure apparent sizes',block-size 'Measure block sizes (block-count * 512B)',block-count 'Count numbers of blocks'}"
1+
complete -c pdu -l bytes-format -d 'How to display the numbers of bytes' -r -f -a "{plain\t'Display plain number of bytes without units',metric\t'Use metric scale, i.e. 1K = 1000B, 1M = 1000K, and so on',binary\t'Use binary scale, i.e. 1K = 1024B, 1M = 1024K, and so on'}"
2+
complete -c pdu -l quantity -d 'Aspect of the files/directories to be measured' -r -f -a "{apparent-size\t'Measure apparent sizes',block-size\t'Measure block sizes (block-count * 512B)',block-count\t'Count numbers of blocks'}"
33
complete -c pdu -l max-depth -d 'Maximum depth to display the data (must be greater than 0)' -r
44
complete -c pdu -l total-width -d 'Width of the visualization' -r
55
complete -c pdu -l column-width -d 'Maximum widths of the tree column and width of the bar column' -r

exports/completion.ps1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ Register-ArgumentCompleter -Native -CommandName 'pdu' -ScriptBlock {
2121

2222
$completions = @(switch ($command) {
2323
'pdu' {
24-
[CompletionResult]::new('--bytes-format', 'bytes-format', [CompletionResultType]::ParameterName, 'How to display the numbers of bytes')
25-
[CompletionResult]::new('--quantity', 'quantity', [CompletionResultType]::ParameterName, 'Aspect of the files/directories to be measured')
26-
[CompletionResult]::new('--max-depth', 'max-depth', [CompletionResultType]::ParameterName, 'Maximum depth to display the data (must be greater than 0)')
27-
[CompletionResult]::new('--total-width', 'total-width', [CompletionResultType]::ParameterName, 'Width of the visualization')
28-
[CompletionResult]::new('--column-width', 'column-width', [CompletionResultType]::ParameterName, 'Maximum widths of the tree column and width of the bar column')
29-
[CompletionResult]::new('--min-ratio', 'min-ratio', [CompletionResultType]::ParameterName, 'Minimal size proportion required to appear')
30-
[CompletionResult]::new('--json-input', 'json-input', [CompletionResultType]::ParameterName, 'Read JSON data from stdin')
31-
[CompletionResult]::new('--json-output', 'json-output', [CompletionResultType]::ParameterName, 'Print JSON data instead of an ASCII chart')
32-
[CompletionResult]::new('--top-down', 'top-down', [CompletionResultType]::ParameterName, 'Print the tree top-down instead of bottom-up')
33-
[CompletionResult]::new('--align-right', 'align-right', [CompletionResultType]::ParameterName, 'Set the root of the bars to the right')
34-
[CompletionResult]::new('--no-sort', 'no-sort', [CompletionResultType]::ParameterName, 'Preserve order of entries')
35-
[CompletionResult]::new('--silent-errors', 'silent-errors', [CompletionResultType]::ParameterName, 'Prevent filesystem error messages from appearing in stderr')
36-
[CompletionResult]::new('--progress', 'progress', [CompletionResultType]::ParameterName, 'Report progress being made at the expense of performance')
37-
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
38-
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
39-
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
40-
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
24+
[CompletionResult]::new('--bytes-format', '--bytes-format', [CompletionResultType]::ParameterName, 'How to display the numbers of bytes')
25+
[CompletionResult]::new('--quantity', '--quantity', [CompletionResultType]::ParameterName, 'Aspect of the files/directories to be measured')
26+
[CompletionResult]::new('--max-depth', '--max-depth', [CompletionResultType]::ParameterName, 'Maximum depth to display the data (must be greater than 0)')
27+
[CompletionResult]::new('--total-width', '--total-width', [CompletionResultType]::ParameterName, 'Width of the visualization')
28+
[CompletionResult]::new('--column-width', '--column-width', [CompletionResultType]::ParameterName, 'Maximum widths of the tree column and width of the bar column')
29+
[CompletionResult]::new('--min-ratio', '--min-ratio', [CompletionResultType]::ParameterName, 'Minimal size proportion required to appear')
30+
[CompletionResult]::new('--json-input', '--json-input', [CompletionResultType]::ParameterName, 'Read JSON data from stdin')
31+
[CompletionResult]::new('--json-output', '--json-output', [CompletionResultType]::ParameterName, 'Print JSON data instead of an ASCII chart')
32+
[CompletionResult]::new('--top-down', '--top-down', [CompletionResultType]::ParameterName, 'Print the tree top-down instead of bottom-up')
33+
[CompletionResult]::new('--align-right', '--align-right', [CompletionResultType]::ParameterName, 'Set the root of the bars to the right')
34+
[CompletionResult]::new('--no-sort', '--no-sort', [CompletionResultType]::ParameterName, 'Preserve order of entries')
35+
[CompletionResult]::new('--silent-errors', '--silent-errors', [CompletionResultType]::ParameterName, 'Prevent filesystem error messages from appearing in stderr')
36+
[CompletionResult]::new('--progress', '--progress', [CompletionResultType]::ParameterName, 'Report progress being made at the expense of performance')
37+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
38+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
39+
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
40+
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
4141
break
4242
}
4343
})

exports/completion.zsh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ _pdu() {
1414
fi
1515

1616
local context curcontext="$curcontext" state line
17-
_arguments "${_arguments_options[@]}" \
17+
_arguments "${_arguments_options[@]}" : \
1818
'--bytes-format=[How to display the numbers of bytes]:BYTES_FORMAT:((plain\:"Display plain number of bytes without units"
1919
metric\:"Use metric scale, i.e. 1K = 1000B, 1M = 1000K, and so on"
2020
binary\:"Use binary scale, i.e. 1K = 1024B, 1M = 1024K, and so on"))' \
2121
'--quantity=[Aspect of the files/directories to be measured]:QUANTITY:((apparent-size\:"Measure apparent sizes"
2222
block-size\:"Measure block sizes (block-count * 512B)"
2323
block-count\:"Count numbers of blocks"))' \
24-
'--max-depth=[Maximum depth to display the data (must be greater than 0)]:MAX_DEPTH: ' \
25-
'(--column-width)--total-width=[Width of the visualization]:TOTAL_WIDTH: ' \
26-
'*--column-width=[Maximum widths of the tree column and width of the bar column]:TREE_WIDTH: :TREE_WIDTH: ' \
27-
'--min-ratio=[Minimal size proportion required to appear]:MIN_RATIO: ' \
24+
'--max-depth=[Maximum depth to display the data (must be greater than 0)]:MAX_DEPTH:_default' \
25+
'(--column-width)--total-width=[Width of the visualization]:TOTAL_WIDTH:_default' \
26+
'*--column-width=[Maximum widths of the tree column and width of the bar column]:TREE_WIDTH:_default:TREE_WIDTH:_default' \
27+
'--min-ratio=[Minimal size proportion required to appear]:MIN_RATIO:_default' \
2828
'(--quantity)--json-input[Read JSON data from stdin]' \
2929
'--json-output[Print JSON data instead of an ASCII chart]' \
3030
'--top-down[Print the tree top-down instead of bottom-up]' \

0 commit comments

Comments
 (0)