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 @@ -185,7 +185,7 @@ extension ArgumentDefinition {

case .custom:
// Generate a call back into the command to retrieve a completions list
let commandName = commands.first!._commandName
let commandName = commands.first!._commandName.zshEscapingCommandName()
return "{_custom_completion $_\(commandName)_commandname \(customCompletionCall(commands)) $words}"
}
}
Expand Down
4 changes: 4 additions & 0 deletions Tests/ArgumentParserUnitTests/CompletionScriptTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ extension CompletionScriptTests {
struct EscapedCommand: ParsableCommand {
@Option(help: #"Escaped chars: '[]\."#)
var one: String

@Argument(completion: .custom { _ in ["d", "e", "f"] })
var two: String
}

func testEscaped_Zsh() throws {
Expand Down Expand Up @@ -222,6 +225,7 @@ _escaped-command() {
local -a args
args+=(
'--one[Escaped chars: '"'"'\\[\\]\\\\.]:one:'
':two:{_custom_completion $_escaped_command_commandname ---completion -- two $words}'
'(-h --help)'{-h,--help}'[Show help information.]'
)
_arguments -w -s -S $args[@] && ret=0
Expand Down