pindexis / qfc

Quick Command-line File Completion
MIT License
580 stars 23 forks source link

Leaver user’s PATH untouched. #17

Open eigengrau opened 9 years ago

eigengrau commented 9 years ago

Instead of adding the location of qfc to the user’s PATH, this leaves PATH untouched and calls qfc at an arbitrary install location instead.

In addition to not adding noise to the user’s path for just one script, this also allows having qfc installed to a location other than ~/.qfc.

eigengrau commented 9 years ago

Seems lots of folks wanted the script path to not be hard-wired to ~/.qfc (cf. #16 & #12). This patch addresses these as well. However, it looks like you don’t actually need to use PATH at all.

pindexis commented 9 years ago

sorry for taking long time to respond, been too busy ):

I like the idea of not touching the PATH environment variable. and I don't think of any reason why someone would call the qfc python command-line directly without passing by the SHELL script.

There are few issues with the code you added though. $0 won't work in BASH when the script is sourced(which is the case here). take a look here: http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

eigengrau commented 9 years ago

Ah, interesting pitfall. I amended the PR using BASH_SOURCE when on Bash. Let me know if anything else might cause problems.

Thanks for making qfc!

desyncr commented 8 years ago

Ping @pindexis