75lb / command-line-args

A mature, feature-complete library to parse command-line options.
MIT License
689 stars 106 forks source link

Bash completion #35

Closed jkremser closed 7 years ago

jkremser commented 7 years ago

If this is implemented, this would be a killer feature. I like the way the args can be declaratively described by the hash. From that hash it would be possible to create the bash completion script. If this script is added to /etc/bash_completion.d it can complete the allowed args when pressing TAB.

yargs has something like that, but it's low lvl api and user needs to implement it basically itself. But these bash completion scripts could be generated. Btw. this is very nice way to do that almost mechanically: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/completion.go and the result is similar to this: https://github.com/janetkuo/kubernetes/blob/b673920ccf83c9448398243ff5ea3afab989d5fc/contrib/completions/bash/kubectl

75lb commented 7 years ago

interesting, thanks.. could be good for command-line-commands too.. will look into it.

75lb commented 7 years ago

closing this for now as I don't see myself implementing it any time soon.. however, feel free to work on it and share the results here!