-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
[enh] bash completion for yunohost cli #678
[enh] bash completion for yunohost cli #678
Conversation
… completion file for the yunohost command based on yunohost.yml, in data/actionsmap Added the output of the script in data/bash-completion.d/yunohost_completion This is probably not the correct place for the script and the generation should be done at some other time and place also.
Again, thx a lot for that work :) |
Very happy to contribute :). Thanks for adding the labels, it indeed needs reviews and tests. I don't know where the script should be put and how it should be run. For tests, I guess, at least checking that the generated file is syntactically correct could be a start ? |
Hey there ! Finally taking the time to have a first look at this ! Thank so much for this, I think many people will find it pleasing to have auto completion ! I'm thinking maybe we can add something to be ran during debian's build to automatically generate the file ? Also since you flagged this as "wip" is there anything else you were thinking about implementing ? I'm gonna test this during the coming days |
Hey, thanks for having a look. |
Alrighty 😉 Indeed the whole Debian build thing ain't trivial at all ! I will have a look soon™ |
Did a few tweaks, still need to test that running the script during debian builds does work |
Just fixed some names for coherence. |
Sooooo tested the debian build and it seems to work okay 👌 That looks good for me, planning to merge soon Note though that not all setups load the bash-completion thing (I believe some commands need to be ran inside the .bashrc of root/admin or something like this ...). There's no trivial solution for this tho ... But we could imagine something to add those command during the initial install. |
Thank you! I think that all the bash-completions are in principle loaded at boot, but otherwise one just has to source the thing once. So maybe putting it in .bashrc is a bit too much but just source the completion file during the initial install may be better ? |
Uuuh I doubt that bash completion is loaded "globally" ? To me it's something that must be sourced by the shell one way or another ... On my machine, I see there's a |
Oh yes you are right, sorry, I got confused. I don't know what is the default for debian actually. Probably people that want to use completion in general have already enabled it. |
So in fact I noticed that there is indeed a
So modulo the "funny" setups who do not install recommended packages (that should be solved, c.f. discussion on YunoHost/issues#1320 ... ) the bash completion should be enabled on all setups I think o/ |
Added a python script (yunohost_completion.py) which generates a bash completion file for the yunohost command based on yunohost.yml, in data/actionsmap
Added the output of the script in data/bash-completion.d/yunohost_completion
This is probably not the correct place for the script and the generation should
be done at some other time and place also.
The problem
missing bash completion for yunohost command
Solution
a python script which generates the file from yunohost.yml
PR Status
[WIP]
How to test
Source the generated file:
source yunohost_completion
then you should be able to auto complete
To regenerate the file:
python yunohost_completion.py
Validation