Pyinfra: bash completion

Created on 20 Jan 2020  路  6Comments  路  Source: Fizzadar/pyinfra

It would be nice to have bash completion for pyinfra command line.

Perhaps we can leverage this: https://click.palletsprojects.com/en/7.x/bashcomplete/

CLI

All 6 comments

So running eval "$(_PYINFRA_COMPLETE=source pyinfra)" already does this! Click is amazing. So I will add the script as scripts/pyinfra-complete.sh.

Script added in https://github.com/Fizzadar/pyinfra/commit/b20b7741f1a67799d0d69453d5f8c86f1b83212e. Works fine but will now look to add more autocomplete helpers to the CLI as per the click docs.

Ok.

Should probably add something to CONTRIBUTING.md and/or another place, but not quite sure where.

Apologies for resurrecting closed issue but wouldn't it make sense to install completions on pip install pyinfra?

@yermulnik no worries! I did some investigation into this but unfortunately it seems bash completion folders vary by OS, OS version and environment! As such I don't think there's really any clean way to do this. However, I am going to improve/highlight the documentation on this, as it should be accessible to all.

@Fizzadar Thank you for taking a look into it. I meant more of having an option to have a completion file installed along with the package itself + howto in README on how to have completion activated by e.g. sourcing the file from within .bashrc.

Was this page helpful?
0 / 5 - 0 ratings