diff --git a/src/cleo/commands/completions_command.py b/src/cleo/commands/completions_command.py index 7d67fa0a..ddf95f9c 100644 --- a/src/cleo/commands/completions_command.py +++ b/src/cleo/commands/completions_command.py @@ -249,7 +249,7 @@ def sanitize(s: str) -> str: command_name = shell_quote(cmd.name) if " " in cmd.name else cmd.name cmds.append( f"complete -c {script_name} -f -n '__fish{function}_no_subcommand' " - f"-a {command_name} -d '{sanitize(cmd.description)}'" + f"-a '{cmd.name}' -d '{sanitize(cmd.description)}'" ) cmds_opts += [ f"# {command_name}", diff --git a/tests/commands/completion/fixtures/fish.txt b/tests/commands/completion/fixtures/fish.txt index 57c02809..8eeafde2 100644 --- a/tests/commands/completion/fixtures/fish.txt +++ b/tests/commands/completion/fixtures/fish.txt @@ -17,10 +17,10 @@ complete -c script -n '__fish_my_function_no_subcommand' -l verbose -d 'Increase complete -c script -n '__fish_my_function_no_subcommand' -l version -d 'Display this application version.' # commands -complete -c script -f -n '__fish_my_function_no_subcommand' -a command:with:colons -d 'Test.' -complete -c script -f -n '__fish_my_function_no_subcommand' -a hello -d 'Complete me please.' -complete -c script -f -n '__fish_my_function_no_subcommand' -a help -d 'Displays help for a command.' -complete -c script -f -n '__fish_my_function_no_subcommand' -a list -d 'Lists commands.' +complete -c script -f -n '__fish_my_function_no_subcommand' -a 'command:with:colons' -d 'Test.' +complete -c script -f -n '__fish_my_function_no_subcommand' -a 'hello' -d 'Complete me please.' +complete -c script -f -n '__fish_my_function_no_subcommand' -a 'help' -d 'Displays help for a command.' +complete -c script -f -n '__fish_my_function_no_subcommand' -a 'list' -d 'Lists commands.' complete -c script -f -n '__fish_my_function_no_subcommand' -a 'spaced command' -d 'Command with space in name.' # command options