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
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ extension [ParsableCommand.Type] {
let line: String
switch arg.names.count {
case 0:
line = ""
line = arg.help.options.contains(.isRepeating) ? "*" : ""
case 1:
line = """
\(arg.isRepeatableOption ? "*" : "")\(arg.names[0].synopsisString)\(arg.zshCompletionAbstract)
\(arg.isRepeatingOption ? "*" : "")\(arg.names[0].synopsisString)\(arg.zshCompletionAbstract)
"""
default:
let synopses = arg.names.map { $0.synopsisString }
line = """
\(arg.isRepeatableOption ? "*" : "(\(synopses.joined(separator: " ")))")'\
\(arg.isRepeatingOption ? "*" : "(\(synopses.joined(separator: " ")))")'\
{\(synopses.joined(separator: ","))}\
'\(arg.zshCompletionAbstract)
"""
Expand Down Expand Up @@ -251,9 +251,9 @@ extension String {
}

extension ArgumentDefinition {
/// - returns: `true` if `self` is an option and can be tab-completed multiple times in one command line.
/// - returns: `true` if `self` is a flag or an option and can be tab-completed multiple times in one command line.
/// For example, `ssh` allows the `-L` option to be given multiple times, to establish multiple port forwardings.
fileprivate var isRepeatableOption: Bool {
fileprivate var isRepeatingOption: Bool {
guard
case .named(_) = kind,
help.options.contains(.isRepeating)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _math_add() {
local -i ret=1
local -ar arg_specs=(
'(--hex-output -x)'{--hex-output,-x}'[Use hexadecimal notation for the result.]'
':values:'
'*:values:'
'--version[Show the version.]'
'(-h --help)'{-h,--help}'[Show help information.]'
)
Expand All @@ -86,7 +86,7 @@ _math_multiply() {
local -i ret=1
local -ar arg_specs=(
'(--hex-output -x)'{--hex-output,-x}'[Use hexadecimal notation for the result.]'
':values:'
'*:values:'
'--version[Show the version.]'
'(-h --help)'{-h,--help}'[Show help information.]'
)
Expand Down Expand Up @@ -130,7 +130,7 @@ _math_stats_average() {
local -ar __math_stats_average_kind=('mean' 'median' 'mode')
local -ar arg_specs=(
'--kind[The kind of average to provide.]:kind:{__math_complete "${__math_stats_average_kind[@]}"}'
':values:'
'*:values:'
'--version[Show the version.]'
'(-h --help)'{-h,--help}'[Show help information.]'
)
Expand All @@ -142,7 +142,7 @@ _math_stats_average() {
_math_stats_stdev() {
local -i ret=1
local -ar arg_specs=(
':values:'
'*:values:'
'--version[Show the version.]'
'(-h --help)'{-h,--help}'[Show help information.]'
)
Expand All @@ -158,7 +158,7 @@ _math_stats_quantiles() {
':one-of-four:{__math_complete "${math_stats_quantiles_one_of_four[@]}"}'
':custom-arg:{__math_custom_complete ---completion stats quantiles -- customArg "${current_word_index}" "$(__math_cursor_index_in_current_word)"}'
':custom-deprecated-arg:{__math_custom_complete ---completion stats quantiles -- customDeprecatedArg}'
':values:'
'*:values:'
'--file:file:_files -g '\''*.txt *.md'\'''
'--directory:directory:_files -/'
'--shell:shell:{local -a list;list=(${(f)"$(head -100 /usr/share/dict/words | tail -50)"});_describe -V "" list}'
Expand All @@ -175,7 +175,7 @@ _math_stats_quantiles() {
_math_help() {
local -i ret=1
local -ar arg_specs=(
':subcommands:'
'*:subcommands:'
'--version[Show the version.]'
)
_arguments -w -s -S : "${arg_specs[@]}" && ret=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ _base-test_escaped-command() {
_base-test_help() {
local -i ret=1
local -ar arg_specs=(
':subcommands:'
'*:subcommands:'
)
_arguments -w -s -S : "${arg_specs[@]}" && ret=0

Expand Down