Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash completion script is broken if an argument() metavar contains spaces #563

Open
joffrey-bion opened this issue Nov 5, 2024 · 0 comments

Comments

@joffrey-bion
Copy link

I have a command like this, and for some reason someone decided to put spaces in the arguments metavar:

internal class RunCommand : AmperSubcommand(name = "run") {
    private val programArguments by argument(name = "program arguments").multiple()

   // ...
}

When sourcing the generated bash completion for this, I get the following error:

-bash: /home/jbion/amper-completion.bash: line 539: syntax error near unexpected token `arguments'
-bash: /home/jbion/amper-completion.bash: line 539: `    program arguments)'

Adding quotes around program arguments in the completion script solves the problem.

I guess there are 2 ways this could be solved:

  1. forbid spaces (and other chars that could mess up with bash) in the metavar name with an explicit doc and error
  2. quote the metavar name in the bash case
@joffrey-bion joffrey-bion changed the title Bash completion script is broken if an argument() name contains spaces Bash completion script is broken if an argument() metavar contains spaces Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant