This is a linux (and similar) commandline only feature request.
Bash has a default completion, which means it completes every argument as a path name. In order to complete stuff like --parameter or options that are not path-related (e.g. numbers) or to specify files ending on some pattern, one has to write a bash completion script. Once done, you can type
lmm<tab>--s<tab>4<tab>--r<tab> ~/my-p<tab>
to get something like
lmms --samplerate 44100 --render ~/my-project.mmz
As I wrote many of those scripts recently, I'd like to write one for LMMS now. Any concerns before I start?
Also, if I write one, if a project file is expected, should it automatically add project files from the LMMS working directory to the completion list even if you are in another directory? E.g. should lmms --render so<tab> complete to lmms --render <lmms working dir>/projects/song1.mmp automatically? The advantage would be quicker navigation to projects without typing your LMMS working directory path; the disadvantage is that you might add a bloat of files even if you don't want to complete from your LMMS working directory...
Concerning the milestone, this could even be done for 1.2.0, if wanted, as it does not affect the LMMS binary.
if a project file is expected, should it automatically add project files from the LMMS working directory to the completion list even if you are in another directory?
Could be a problem of taste, but I don't think so. The disadvantage looks greater to me.
The help has been restructured per #4567 . I'll add a commit introducing the completion (tomorrow?), then this should be finished.
Ok, I just pushed 9e0ee04 (see above). It's white-listing to only use /usr and /usr/local. I also removed the shell script, as it would sound very strange if users could write to /usr/local, but not /usr/local/share/completions/bash-completion.
Somehow, I'm OK with the solution. Don't want to complicate it further.
Reviews are appreciated.
@tresf Can you please test if installation works, and if it really completes after instalation (e.g. in your container)?
Full code available here: https://github.com/LMMS/lmms/compare/stable-1.2...JohannesLorenz:stable-1.2
Please wait with testing, I just want to add another whitelist case (install to /usr and bashcomp in /etc...)... 10 minutes...
@JohannesLorenz I still would like to find a way to bundle this into the .AppImage if possible. Perhaps add a whitelist for /home and and assume it's a user-directory?
Closed via 93dc557.
Most helpful comment
Could be a problem of taste, but I don't think so. The disadvantage looks greater to me.