Skip to content

Commit 0a14ab2

Browse files
authored
Merge 6c4da4c into 462be71
2 parents 462be71 + 6c4da4c commit 0a14ab2

26 files changed

Lines changed: 665 additions & 14 deletions

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ rayon = "1.10.0"
7070
rounded-div = "0.1.4"
7171
serde = { version = "1.0.228", optional = true }
7272
serde_json = { version = "1.0.149", optional = true }
73+
lscolors = { version = "0.21", features = ["nu-ansi-term"] }
7374
smart-default = "0.7.1"
7475
sysinfo = "0.38.2"
7576
terminal_size = "0.4.3"
@@ -83,3 +84,4 @@ maplit = "1.0.2"
8384
normalize-path = "0.2.1"
8485
pretty_assertions = "1.4.1"
8586
rand = "0.10.0"
87+
strip-ansi-escapes = "0.2.1"

USAGE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,17 @@ Do not output `.shared.details` in the JSON output.
125125

126126
Do not output `.shared.summary` in the JSON output.
127127

128+
<a id="color" name="color"></a>
129+
### `--color`
130+
131+
* _Default:_ `auto`.
132+
* _Choices:_
133+
- `auto`: Detect if the output is a TTY and render colors accordingly
134+
- `always`: Always render colors
135+
- `never`: Never render colors
136+
137+
Whether to show colors.
138+
128139
<a id="option-h" name="option-h"></a><a id="help" name="help"></a>
129140
### `--help`
130141

exports/completion.bash

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _pdu() {
2323

2424
case "${cmd}" in
2525
pdu)
26-
opts="-b -H -q -d -w -m -s -p -h -V --json-input --json-output --bytes-format --detect-links --dedupe-links --deduplicate-hardlinks --top-down --align-right --quantity --depth --max-depth --width --total-width --column-width --min-ratio --no-sort --no-errors --silent-errors --progress --threads --omit-json-shared-details --omit-json-shared-summary --help --version [FILES]..."
26+
opts="-b -H -q -d -w -m -s -p -h -V --json-input --json-output --bytes-format --detect-links --dedupe-links --deduplicate-hardlinks --top-down --align-right --quantity --depth --max-depth --width --total-width --column-width --min-ratio --no-sort --no-errors --silent-errors --progress --threads --omit-json-shared-details --omit-json-shared-summary --color --help --version [FILES]..."
2727
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
2828
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
2929
return 0
@@ -85,6 +85,10 @@ _pdu() {
8585
COMPREPLY=($(compgen -f "${cur}"))
8686
return 0
8787
;;
88+
--color)
89+
COMPREPLY=($(compgen -W "auto always never" -- "${cur}"))
90+
return 0
91+
;;
8892
*)
8993
COMPREPLY=()
9094
;;

exports/completion.elv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set edit:completion:arg-completer[pdu] = {|@words|
3232
cand -m 'Minimal size proportion required to appear'
3333
cand --min-ratio 'Minimal size proportion required to appear'
3434
cand --threads 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer'
35+
cand --color 'Whether to show colors'
3536
cand --json-input 'Read JSON data from stdin'
3637
cand --json-output 'Print JSON data instead of an ASCII chart'
3738
cand -H 'Detect and subtract the sizes of hardlinks from their parent directory totals'

exports/completion.fish

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ complete -c pdu -s w -l total-width -l width -d 'Width of the visualization' -r
99
complete -c pdu -l column-width -d 'Maximum widths of the tree column and width of the bar column' -r
1010
complete -c pdu -s m -l min-ratio -d 'Minimal size proportion required to appear' -r
1111
complete -c pdu -l threads -d 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer' -r
12+
complete -c pdu -l color -d 'Whether to show colors' -r -f -a "auto\t'Detect if the output is a TTY and render colors accordingly'
13+
always\t'Always render colors'
14+
never\t'Never render colors'"
1215
complete -c pdu -l json-input -d 'Read JSON data from stdin'
1316
complete -c pdu -l json-output -d 'Print JSON data instead of an ASCII chart'
1417
complete -c pdu -s H -l deduplicate-hardlinks -l detect-links -l dedupe-links -d 'Detect and subtract the sizes of hardlinks from their parent directory totals'

exports/completion.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Register-ArgumentCompleter -Native -CommandName 'pdu' -ScriptBlock {
3535
[CompletionResult]::new('-m', '-m', [CompletionResultType]::ParameterName, 'Minimal size proportion required to appear')
3636
[CompletionResult]::new('--min-ratio', '--min-ratio', [CompletionResultType]::ParameterName, 'Minimal size proportion required to appear')
3737
[CompletionResult]::new('--threads', '--threads', [CompletionResultType]::ParameterName, 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer')
38+
[CompletionResult]::new('--color', '--color', [CompletionResultType]::ParameterName, 'Whether to show colors')
3839
[CompletionResult]::new('--json-input', '--json-input', [CompletionResultType]::ParameterName, 'Read JSON data from stdin')
3940
[CompletionResult]::new('--json-output', '--json-output', [CompletionResultType]::ParameterName, 'Print JSON data instead of an ASCII chart')
4041
[CompletionResult]::new('-H', '-H ', [CompletionResultType]::ParameterName, 'Detect and subtract the sizes of hardlinks from their parent directory totals')

exports/completion.zsh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ block-count\:"Count numbers of blocks"))' \
3737
'-m+[Minimal size proportion required to appear]:MIN_RATIO:_default' \
3838
'--min-ratio=[Minimal size proportion required to appear]:MIN_RATIO:_default' \
3939
'--threads=[Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer]:THREADS:_default' \
40+
'--color=[Whether to show colors]:COLOR:((auto\:"Detect if the output is a TTY and render colors accordingly"
41+
always\:"Always render colors"
42+
never\:"Never render colors"))' \
4043
'(-q --quantity -H --deduplicate-hardlinks)--json-input[Read JSON data from stdin]' \
4144
'--json-output[Print JSON data instead of an ASCII chart]' \
4245
'-H[Detect and subtract the sizes of hardlinks from their parent directory totals]' \

exports/long.help

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ Options:
8888
--omit-json-shared-summary
8989
Do not output `.shared.summary` in the JSON output
9090

91+
--color <COLOR>
92+
Whether to show colors
93+
94+
Possible values:
95+
- auto: Detect if the output is a TTY and render colors accordingly
96+
- always: Always render colors
97+
- never: Never render colors
98+
99+
[default: auto]
100+
91101
-h, --help
92102
Print help (see a summary with '-h')
93103

exports/short.help

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Options:
4040
Do not output `.shared.details` in the JSON output
4141
--omit-json-shared-summary
4242
Do not output `.shared.summary` in the JSON output
43+
--color <COLOR>
44+
Whether to show colors [default: auto] [possible values: auto, always, never]
4345
-h, --help
4446
Print help (see more with '--help')
4547
-V, --version

0 commit comments

Comments
 (0)