bash-completion icon indicating copy to clipboard operation
bash-completion copied to clipboard

killall, pidof: complete executable path

Open kevinoid opened this issue 2 years ago • 1 comments

Describe the feature/solution

The completions for killall and pidof currently complete process names, but not executable paths, as supported by the BusyBox, psmisc, SysV Init present on most Linux systems.

Preferably the completion would only match paths starting with /, since BusyBox, psmisc and SysV Init use the leading / to distinguish paths from names. It may also be useful to limit matched paths to files with execute permission, since it's unlikely running processes would be non-executable.

Unfortunately, not all versions of killall and pidof support path arguments (e.g. FreeBSD killall). I'm not sure whether it's worth excluding such versions and, if so, how best to do so.

Thanks for considering!

kevinoid avatar Feb 25 '22 00:02 kevinoid

Ack.

If we'd complete paths only when the initial slash was entered by the user, I think that would be kind of enough as users on systems that don't support that are somewhat unlikely to enter the slash.

Another approach we could take is to conditionalize like if _userland GNU; then .... That would be cheating a bit, but could work for practical purposes.

scop avatar Mar 13 '22 13:03 scop