hyperqueue icon indicating copy to clipboard operation
hyperqueue copied to clipboard

hq submit bash completion should include only executable files

Open goxeq opened this issue 3 years ago • 3 comments

The shell completion script (cf #290) for hq submit does not take into account that only executable files are acceptable as commands and also lists non-executable files. So, if I type hq submit ./, it gives me as completions all files in the directory, whereas it should only give executable files and directories.

For example,

$ mkdir a
$ touch b
$ touch c
$ chmod +x c
$ hq submit ./  <TAB>
a/ b  c
$ nohup ./ <TAB >
a/ c

goxeq avatar Jan 17 '22 15:01 goxeq

Hi, which shell do you use? It seems that the library that we use for CLI parsing (https://github.com/clap-rs/clap) currently doesn't support such completion for bash.

Kobzol avatar Jan 17 '22 16:01 Kobzol

I use bash. Thanks for looking at this.

goxeq avatar Jan 17 '22 21:01 goxeq

I checked the implementation in the library and indeed for bash this is not implemented yet (it should work for zsh). There is some interest in making this work (https://github.com/clap-rs/clap/issues/1232), so hopefully it will be implemented in the future, but probably not very soon.

We could in theory reimplement bash completion from scratch and add support for this, but, to be honest, it's a lot of work and something like that is very low on our priority list for now.

Kobzol avatar Jan 18 '22 07:01 Kobzol