File tree Expand file tree Collapse file tree 4 files changed +11
-10
lines changed
Sources/ArgumentParser/Completions
Tests/ArgumentParserUnitTests/Snapshots Expand file tree Collapse file tree 4 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -149,12 +149,13 @@ extension ArgumentDefinition {
149149 /// Returns a string with the arguments for the callback to generate custom completions for
150150 /// this argument.
151151 func customCompletionCall( _ commands: [ ParsableCommand . Type ] ) -> String {
152- let subcommandNames = commands . dropFirst ( ) . map { $0 . _commandName } . joined (
153- separator : " " )
152+ let subcommandNames =
153+ commands . dropFirst ( ) . map { " \( $0 . _commandName ) " } . joined ( )
154154 let argumentName =
155155 names. preferredName? . synopsisString
156- ?? self . help. keys. first? . fullPathString ?? " --- "
157- return " ---completion \( subcommandNames) -- \( argumentName) "
156+ ?? self . help. keys. first? . fullPathString
157+ ?? " --- "
158+ return " ---completion \( subcommandNames) -- \( argumentName) "
158159 }
159160}
160161
Original file line number Diff line number Diff line change @@ -182,11 +182,11 @@ _base_test() {
182182 # Offer positional completions
183183 case " ${positional_number} " in
184184 1)
185- __base_test_add_completions -W " $( __base_test_custom_complete ---completion -- argument) "
185+ __base_test_add_completions -W " $( __base_test_custom_complete ---completion -- argument) "
186186 return
187187 ;;
188188 2)
189- __base_test_add_completions -W " $( __base_test_custom_complete ---completion -- nested.nestedArgument) "
189+ __base_test_add_completions -W " $( __base_test_custom_complete ---completion -- nested.nestedArgument) "
190190 return
191191 ;;
192192 esac
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ complete -c 'base-test' -n '__base-test_should_offer_completions_for "base-test"
8080complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test"' -l kind-counter
8181complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test"' -l rep1 -rfka ' '
8282complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test"' -s r -l rep2 -rfka ' '
83- complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test" 1' -fka ' (__base-test_custom_completion ---completion -- argument)'
84- complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test" 2' -fka ' (__base-test_custom_completion ---completion -- nested.nestedArgument)'
83+ complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test" 1' -fka ' (__base-test_custom_completion ---completion -- argument)'
84+ complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test" 2' -fka ' (__base-test_custom_completion ---completion -- nested.nestedArgument)'
8585complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test"' -s h -l help -d ' Show help information.'
8686complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test" 3' -fa ' sub-command' -d ' '
8787complete -c ' base-test' -n ' __base-test_should_offer_completions_for "base-test" 3' -fa ' escaped-command' -d ' '
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ _base-test() {
4747 ' *--kind-counter'
4848 ' *--rep1:rep1:'
4949 ' *' {-r,--rep2}' :rep2:'
50- ' :argument:{__base-test_custom_complete "${command_name}" ---completion -- argument "${command_line[@]}"}'
51- ' :nested-argument:{__base-test_custom_complete "${command_name}" ---completion -- nested.nestedArgument "${command_line[@]}"}'
50+ ' :argument:{__base-test_custom_complete "${command_name}" ---completion -- argument "${command_line[@]}"}'
51+ ' :nested-argument:{__base-test_custom_complete "${command_name}" ---completion -- nested.nestedArgument "${command_line[@]}"}'
5252 ' (-h --help)' {-h,--help}' [Show help information.]'
5353 ' (-): :->command'
5454 ' (-)*:: :->arg'
You can’t perform that action at this time.
0 commit comments