drone-cli
drone-cli copied to clipboard
Add Bash completions
This pull request adds Bash completions for all of Drone's commands and sub-commands.
Notes regarding implementation:
- Short options (i.e.
-h,-s, etc etc.) aren't shown as flags in completions, as there's not really much to complete in them. - Long options are hidden on commands that have subcommands until a hyphen is typed on the current argument (i.e. for
drone plugins,--helpwon't be shown as a completion option until at least-is typed). - The above implementation was based off that off
apt-get, which has the same behavior. - This PR doesn't aim to add completions for any dynamic data (i.e. things like repositories or users), though if that's a must I'd be more than glad to look into implementing such.
Any thoughts @bradrydzewski @tphoney?
Hey @hwittenborn many thanks for looking into this. I am bad person, i kept meaning to try this out and haven,t. mia culpa
If i wanted to test this locally what do i need to do ? how do i test this ?
Great! Not a problem on the wait :)
To test everything locally, you should just need to run source ./drone.bash from a Bash shell in the directory containing the completion file.
You should then be able to use the completion normally as if it were packaged up and everything. I wasn't sure if you were familiar with completions either, but you should be able to use them by typing drone and then hitting the Tab key a few times, after which it'll just keep suggesting while your type with further Tab kep presses.
@tphoney: Any update on this?
👀 now, apologies. I was doing a fair bit of work on drone-cli to improve signing linting and exec.
First off, its is soo awesome. So i gave it a test drive 🚗 , and when i tried it in my default shell zsh. It did not work. Once i flipped my shell to bash everything was 😎 So my question would be, do you know if there is much of an effort to add additional shell support.
I don't use ZSH myself, but I've heard it has Bash completion emulation, so I'll look into setting that up for this.
Did an error pop up when you used it under ZSH though, or did it just not work?
I was doing a fair bit of work on drone-cli to improve signing linting and exec.
All good too :)
This PR has been automatically closed due to inactivity.