apple / swift-argument-parser

Straightforward, type-safe argument parsing for Swift
Apache License 2.0
3.33k stars 319 forks source link

Bash does not like '-' in function names #573

Closed kennyyork closed 11 months ago

kennyyork commented 1 year ago

If a ParsableCommand has a commandName value with a hyphen, the bash completion generator will generate a function name with a hyphen which isn't valid in BASH, eg _programName_command_sub-command': not a valid identifier

Checklist

natecook1000 commented 1 year ago

Thanks so much for working on this, @kennyyork!

It looks like we're already escaping in this way for zsh, and it's probably safe to assume that fish has this same requirement. Could you rename the existing zshEscapingCommandName method to shellEscapingCommandName, and then have all three script generators use that?

natecook1000 commented 11 months ago

@swift-ci Please test

natecook1000 commented 11 months ago

@swift-ci Please test