Skip to content

Commit 854c36c

Browse files
committed
Improve compatibility with Fish 3.3.0
- Don't use `-f` option for `set` - Don't use `$(...)` syntax, only `(...)`
1 parent 2244788 commit 854c36c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Sources/ArgumentParser/Completions/FishCompletionsGenerator.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ extension [ParsableCommand.Type] {
1818
let commandName = first!._commandName
1919
return """
2020
function \(shouldOfferCompletionsForFunctionName) -a expected_commands -a expected_positional_index
21-
set -f unparsed_tokens (\(tokensFunctionName) -pc)
22-
set -f positional_index 0
23-
set -f commands
21+
set -l unparsed_tokens (\(tokensFunctionName) -pc)
22+
set -l positional_index 0
23+
set -l commands
2424
2525
switch $unparsed_tokens[1]
2626
\(commandCases)
@@ -30,7 +30,7 @@ extension [ParsableCommand.Type] {
3030
end
3131
3232
function \(tokensFunctionName)
33-
if test "$(string split -m 1 -f 1 -- . "$FISH_VERSION")" -gt 3
33+
if test (string split -m 1 -f 1 -- . "$FISH_VERSION") -gt 3
3434
commandline --tokens-raw $argv
3535
else
3636
commandline -o $argv
@@ -39,8 +39,8 @@ extension [ParsableCommand.Type] {
3939
4040
function \(parseSubcommandFunctionName) -S
4141
argparse -s r -- $argv
42-
set -f positional_count $argv[1]
43-
set -f option_specs $argv[2..]
42+
set -l positional_count $argv[1]
43+
set -l option_specs $argv[2..]
4444
4545
set -a commands $unparsed_tokens[1]
4646
set -e unparsed_tokens[1]
@@ -59,20 +59,20 @@ extension [ParsableCommand.Type] {
5959
end
6060
6161
function \(completeDirectoriesFunctionName)
62-
set -f token (commandline -t)
62+
set -l token (commandline -t)
6363
string match -- '*/' $token
64-
set -f subdirs $token*/
64+
set -l subdirs $token*/
6565
printf '%s\\n' $subdirs
6666
end
6767
6868
function \(customCompletionFunctionName)
6969
set -x \(CompletionShell.shellEnvironmentVariableName) fish
7070
set -x \(CompletionShell.shellVersionEnvironmentVariableName) $FISH_VERSION
7171
72-
set -f tokens (\(tokensFunctionName) -p)
73-
if test -z "$(\(tokensFunctionName) -t)"
74-
set -f index (count (\(tokensFunctionName) -pc))
75-
set -f tokens $tokens[..$index] \\'\\' $tokens[$(math $index + 1)..]
72+
set -l tokens (\(tokensFunctionName) -p)
73+
if test -z "(\(tokensFunctionName) -t)"
74+
set -l index (count (\(tokensFunctionName) -pc))
75+
set tokens $tokens[..$index] \\'\\' $tokens[(math $index + 1)..]
7676
end
7777
command $tokens[1] $argv $tokens
7878
end

0 commit comments

Comments
 (0)