himanshub16 / ProxyMan

Configuring proxy settings made easy.
https://github.com/himanshub16/ProxyMan/releases/latest/
MIT License
683 stars 108 forks source link

Fish support based on macOS support #100

Open deg0nz opened 4 years ago

deg0nz commented 4 years ago

Hi,

I added support for setting proxy variables in fish shell. Since fish also supports setting shell variables with bash syntax, we can just use the existing code and let it write into the config.fish file.

This PR is tested on macOS, but should work on all the other platforms as well, since there is no real difference.

This PR is based on the changes of the macOS support PR, so this should be merged afterwards.

@himanshub16 Please note: I have the same feature lying around without the macOS stuff. So if you like, I could make another PR so you can add fish support earlier. Just drop me a line :)

deg0nz commented 3 years ago

There were some flaws in the code. Fish shell needs environment variables to be explicitely unset with set -e $VAR. This was not the case before, so Proxy variables have still been set after executing proxyman unset. The script now adds those lines to config.fish and deletes them when setting new variables. Everything should be fine now.

Additionally, the usage of the sed command is now OS-independent

Commit 75e62e6 fixes this.

EDIT: add more information