Skip to content

Commit

Permalink
Fix bug with default arg values
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Dec 20, 2024
1 parent 7718ba7 commit fcc4545
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
8 changes: 4 additions & 4 deletions completion/_tex-fmt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ _tex-fmt() {

local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" : \
'-l+[Line length for wrapping]: :_default' \
'--wraplen=[Line length for wrapping]: :_default' \
'-t+[Number of characters to use as tab size]: :_default' \
'--tabsize=[Number of characters to use as tab size]: :_default' \
'-l+[Line length for wrapping \[default\: 80\]]: :_default' \
'--wraplen=[Line length for wrapping \[default\: 80\]]: :_default' \
'-t+[Number of characters to use as tab size \[default\: 2\]]: :_default' \
'--tabsize=[Number of characters to use as tab size \[default\: 2\]]: :_default' \
'--config=[Path to configuration file]: :_files' \
'--completion=[Generate shell completion script]:shell:(bash elvish fish powershell zsh)' \
'-c[Check formatting, do not modify files]' \
Expand Down
8 changes: 4 additions & 4 deletions completion/_tex-fmt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Register-ArgumentCompleter -Native -CommandName 'tex-fmt' -ScriptBlock {

$completions = @(switch ($command) {
'tex-fmt' {
[CompletionResult]::new('-l', '-l', [CompletionResultType]::ParameterName, 'Line length for wrapping')
[CompletionResult]::new('--wraplen', '--wraplen', [CompletionResultType]::ParameterName, 'Line length for wrapping')
[CompletionResult]::new('-t', '-t', [CompletionResultType]::ParameterName, 'Number of characters to use as tab size')
[CompletionResult]::new('--tabsize', '--tabsize', [CompletionResultType]::ParameterName, 'Number of characters to use as tab size')
[CompletionResult]::new('-l', '-l', [CompletionResultType]::ParameterName, 'Line length for wrapping [default: 80]')
[CompletionResult]::new('--wraplen', '--wraplen', [CompletionResultType]::ParameterName, 'Line length for wrapping [default: 80]')
[CompletionResult]::new('-t', '-t', [CompletionResultType]::ParameterName, 'Number of characters to use as tab size [default: 2]')
[CompletionResult]::new('--tabsize', '--tabsize', [CompletionResultType]::ParameterName, 'Number of characters to use as tab size [default: 2]')
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'Path to configuration file')
[CompletionResult]::new('--completion', '--completion', [CompletionResultType]::ParameterName, 'Generate shell completion script')
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'Check formatting, do not modify files')
Expand Down
8 changes: 4 additions & 4 deletions completion/tex-fmt.elv
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ set edit:completion:arg-completer[tex-fmt] = {|@words|
}
var completions = [
&'tex-fmt'= {
cand -l 'Line length for wrapping'
cand --wraplen 'Line length for wrapping'
cand -t 'Number of characters to use as tab size'
cand --tabsize 'Number of characters to use as tab size'
cand -l 'Line length for wrapping [default: 80]'
cand --wraplen 'Line length for wrapping [default: 80]'
cand -t 'Number of characters to use as tab size [default: 2]'
cand --tabsize 'Number of characters to use as tab size [default: 2]'
cand --config 'Path to configuration file'
cand --completion 'Generate shell completion script'
cand -c 'Check formatting, do not modify files'
Expand Down
4 changes: 2 additions & 2 deletions completion/tex-fmt.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
complete -c tex-fmt -s l -l wraplen -d 'Line length for wrapping' -r
complete -c tex-fmt -s t -l tabsize -d 'Number of characters to use as tab size' -r
complete -c tex-fmt -s l -l wraplen -d 'Line length for wrapping [default: 80]' -r
complete -c tex-fmt -s t -l tabsize -d 'Number of characters to use as tab size [default: 2]' -r
complete -c tex-fmt -l config -d 'Path to configuration file' -r -F
complete -c tex-fmt -l completion -d 'Generate shell completion script' -r -f -a "{bash\t'',elvish\t'',fish\t'',powershell\t'',zsh\t''}"
complete -c tex-fmt -s c -l check -d 'Check formatting, do not modify files'
Expand Down
8 changes: 4 additions & 4 deletions man/tex-fmt.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Print to stdout, do not modify files
\fB\-n\fR, \fB\-\-nowrap\fR
Do not wrap long lines
.TP
\fB\-l\fR, \fB\-\-wraplen\fR [default: 80]
Line length for wrapping
\fB\-l\fR, \fB\-\-wraplen\fR
Line length for wrapping [default: 80]
.TP
\fB\-t\fR, \fB\-\-tabsize\fR [default: 2]
Number of characters to use as tab size
\fB\-t\fR, \fB\-\-tabsize\fR
Number of characters to use as tab size [default: 2]
.TP
\fB\-\-usetabs\fR
Use tabs instead of spaces for indentation
Expand Down
6 changes: 2 additions & 4 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ fn get_cli_command() -> Command {
.short('l')
.long("wraplen")
.value_parser(value_parser!(u8))
.default_value("80")
.help("Line length for wrapping"),
.help("Line length for wrapping [default: 80]"),
)
.arg(
Arg::new("tabsize")
.short('t')
.long("tabsize")
.value_parser(value_parser!(u8))
.default_value("2")
.help("Number of characters to use as tab size"),
.help("Number of characters to use as tab size [default: 2]"),
)
.arg(
Arg::new("usetabs")
Expand Down

0 comments on commit fcc4545

Please sign in to comment.