Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fish support based on macOS support #100

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

deg0nz
Copy link

@deg0nz deg0nz commented Apr 9, 2020

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 and others added 21 commits January 25, 2020 20:53
Create some kind of interface for different OSes:
Main functions for setting proxies are split into different files for each OS which contain identical function names.
The corresponding file gets sourced at the beginning of the file.
BSD readlink has a different functionality than GNU's readlink. We need to use realpath on macOS.
BSD sed's syntax is different from the GNU one. We check for the OS in the unset function and call the corresponding sed syntax
also removed unnecessary hashtag
also added networksetup entry to do_all function
...because this function is not implemented yet.
in networksetup.sh -> set_proxy()
This was a copy and paste error
macOS does not come with realpath per default, so we need a portable substitute for this
... on basis of already supported macOS
by using /usr/bin/env, we can just execute this with fish shell as well
+ make sed command OS independent
+ use only 1 for-loop for unsetting variables and modify variable to uppercase
+ make code more readable by splitting variable removal into own function
@deg0nz
Copy link
Author

deg0nz commented Sep 22, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant