Closed aik099 closed 7 years ago
@aik099 I wanted to test how this affects backwards compatibility before merging. In theory it should be fine because Bash completion falls back to looking up basename anyway:
If the command word is a full pathname, a compspec for the full pathname is searched for first. If no compspec is found for the full pathname, an attempt is made to find a compspec for the portion following the final slash — (8.6 Programmable Completion)
Based on this, it probably makes sense to remove the alias option completely and always use basename
as you implemented. Would anyone have an objection to that?
From a quick check now, the only case that stops working for me is completing for a program in my home directory. The program path is interpreted as a literal tilde:
$ ~/bin/beam [tab]
-bash: ~/bin/beam: No such file or directory
From a quick check now, the only case that stops working for me is completing for a program in my home directory.
And if you specify -m
option to the hook generation command, then will it start working? If it will, then another suggestion for this PR (from my side) would be to also make -m
(--multiple
) option default to true
.
Na the issue is with the way the multiple flag uses $1
instead of a fixed path. I was using it for testing the forced basename, but forgot it had this side effect. So that's actually a separate issue:
RESULT="$($1 _completion)";
# resolves to literally
RESULT="$('~/bin/beam' _completion)";
# instead of
RESULT="$("$HOME/bin/beam" _completion)";
If that can be resolved, multiple
could be on by default too I think.
Closes #45