Skip to content

Commit 5218cf0

Browse files
committed
Refactor fish completions to use ToolInfoV0.
Signed-off-by: Ross Goldberg <[email protected]>
1 parent ea3c17f commit 5218cf0

File tree

4 files changed

+135
-161
lines changed

4 files changed

+135
-161
lines changed

Sources/ArgumentParser/Completions/CompletionsGenerator.swift

+1-9
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ struct CompletionsGenerator {
144144
case .bash:
145145
return ToolInfoV0(commandStack: [command]).bashCompletionScript
146146
case .fish:
147-
return [command].fishCompletionScript
147+
return ToolInfoV0(commandStack: [command]).fishCompletionScript
148148
default:
149149
fatalError("Invalid CompletionShell: \(shell)")
150150
}
@@ -177,14 +177,6 @@ extension ParsableCommand {
177177
}
178178

179179
extension [ParsableCommand.Type] {
180-
var positionalArguments: [ArgumentDefinition] {
181-
guard let command = last else {
182-
return []
183-
}
184-
return ArgumentSet(command, visibility: .default, parent: nil)
185-
.filter(\.isPositional)
186-
}
187-
188180
/// Include default 'help' subcommand in nonempty subcommand list if & only if
189181
/// no help subcommand already exists.
190182
mutating func addHelpSubcommandIfMissing() {

0 commit comments

Comments
 (0)