Skip to content

Commit 070273b

Browse files
committed
Use prior bindings to improve performance in bash completion script generation.
Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
1 parent f3e4dec commit 070273b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/ArgumentParser/Completions/BashCompletionsGenerator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ extension CommandInfoV0 {
234234
// Generate the case pattern-matching statements for option values.
235235
// If there aren't any, skip the case block altogether.
236236
let optionHandlers =
237-
arguments.compactMap { arg in
237+
options.compactMap { arg in
238238
guard arg.kind != .flag else { return nil }
239239
let words = arg.completionWords
240240
guard !words.isEmpty else { return nil }
241241
return """
242-
\(arg.completionWords.map { "'\($0.shellEscapeForSingleQuotedString())'" }.joined(separator: "|")))
242+
\(words.map { "'\($0.shellEscapeForSingleQuotedString())'" }.joined(separator: "|")))
243243
\(valueCompletion(arg).indentingEachLine(by: 8))\
244244
return
245245
;;

0 commit comments

Comments
 (0)