stecman / symfony-console-completion

Automatic tab-key completion for Symfony console application options, arguments and parameters
MIT License
420 stars 26 forks source link

Tilde in program path interpreted literally when using `--multiple` #70

Open stecman opened 7 years ago

stecman commented 7 years ago

The multiple option uses $1 instead of a fixed path for the completion program. When trying to complete for a program in the home directory using a path starting with ~/, the program path is interpreted as containing a literal tilde character, instead of expanding to $HOME.

This:

RESULT="$($1 _completion)";

resolves to effectively:

RESULT="$('~/bin/beam' _completion)";

which results in an error:

$ ~/bin/beam [tab]
-bash: ~/bin/beam: No such file or directory

instead of the expected behaviour:

RESULT="$("$HOME/bin/beam" _completion)";

Once this is resolved, multiple could be on by default too I think.

Tested using Bash 4.3 and 3.2.on OSX.

aik099 commented 7 years ago

Replacing ~ with ${HOME} in app path used in RESULT variable in hook code sounds like a plan.