Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exports/completion.elv
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set edit:completion:arg-completer[pdu] = {|@words|
cand --column-width 'Maximum widths of the tree column and width of the bar column'
cand -m 'Minimal size proportion required to appear'
cand --min-ratio 'Minimal size proportion required to appear'
cand --threads 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a number'
cand --threads 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer'
cand --json-input 'Read JSON data from stdin'
cand --json-output 'Print JSON data instead of an ASCII chart'
cand -H 'Detect and subtract the sizes of hardlinks from their parent directory totals'
Expand Down
2 changes: 1 addition & 1 deletion exports/completion.fish
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ complete -c pdu -s d -l max-depth -l depth -d 'Maximum depth to display the data
complete -c pdu -s w -l total-width -l width -d 'Width of the visualization' -r
complete -c pdu -l column-width -d 'Maximum widths of the tree column and width of the bar column' -r
complete -c pdu -s m -l min-ratio -d 'Minimal size proportion required to appear' -r
complete -c pdu -l threads -d 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a number' -r
complete -c pdu -l threads -d 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer' -r
complete -c pdu -l json-input -d 'Read JSON data from stdin'
complete -c pdu -l json-output -d 'Print JSON data instead of an ASCII chart'
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'
Expand Down
2 changes: 1 addition & 1 deletion exports/completion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Register-ArgumentCompleter -Native -CommandName 'pdu' -ScriptBlock {
[CompletionResult]::new('--column-width', '--column-width', [CompletionResultType]::ParameterName, 'Maximum widths of the tree column and width of the bar column')
[CompletionResult]::new('-m', '-m', [CompletionResultType]::ParameterName, 'Minimal size proportion required to appear')
[CompletionResult]::new('--min-ratio', '--min-ratio', [CompletionResultType]::ParameterName, 'Minimal size proportion required to appear')
[CompletionResult]::new('--threads', '--threads', [CompletionResultType]::ParameterName, 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a number')
[CompletionResult]::new('--threads', '--threads', [CompletionResultType]::ParameterName, 'Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer')
[CompletionResult]::new('--json-input', '--json-input', [CompletionResultType]::ParameterName, 'Read JSON data from stdin')
[CompletionResult]::new('--json-output', '--json-output', [CompletionResultType]::ParameterName, 'Print JSON data instead of an ASCII chart')
[CompletionResult]::new('-H', '-H ', [CompletionResultType]::ParameterName, 'Detect and subtract the sizes of hardlinks from their parent directory totals')
Expand Down
2 changes: 1 addition & 1 deletion exports/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ block-count\:"Count numbers of blocks"))' \
'*--column-width=[Maximum widths of the tree column and width of the bar column]:TREE_WIDTH:_default:TREE_WIDTH:_default' \
'-m+[Minimal size proportion required to appear]:MIN_RATIO:_default' \
'--min-ratio=[Minimal size proportion required to appear]:MIN_RATIO:_default' \
'--threads=[Set the maximum number of threads to spawn. Could be either "auto", "max", or a number]:THREADS:_default' \
'--threads=[Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer]:THREADS:_default' \
'(-q --quantity -H --deduplicate-hardlinks)--json-input[Read JSON data from stdin]' \
'--json-output[Print JSON data instead of an ASCII chart]' \
'-H[Detect and subtract the sizes of hardlinks from their parent directory totals]' \
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl App {
}
}
Threads::Max => None,
Threads::Fixed(threads) => Some(threads),
Threads::Fixed(threads) => Some(threads.get()),
};

if let Some(threads) = threads {
Expand Down
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub struct Args {
#[clap(long, short)]
pub progress: bool,

/// Set the maximum number of threads to spawn. Could be either "auto", "max", or a number.
/// Set the maximum number of threads to spawn. Could be either "auto", "max", or a positive integer.
#[clap(long, default_value_t = Threads::Auto)]
pub threads: Threads,

Expand Down
7 changes: 5 additions & 2 deletions src/args/threads.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use derive_more::{Display, Error};
use std::{num::ParseIntError, str::FromStr};
use std::{
num::{NonZeroUsize, ParseIntError},
str::FromStr,
};

const AUTO: &str = "auto";
const MAX: &str = "max";
Expand All @@ -12,7 +15,7 @@ pub enum Threads {
Auto,
#[display("{MAX}")]
Max,
Fixed(usize),
Fixed(NonZeroUsize),
}

/// Error that occurs when parsing a string to as [`Threads`].
Expand Down
Loading