A simple cli tool for setting up proxy environment variables. Automatically reads the proxy settings from the system and sets them up in the environment variables.
TODO
Bash
Add the following line to your .bashrc
or .bash_profile
:
eval "$(termproxy init bash)"
Cmd
-
Add a string value to the registry key:
- Apply
.cmdrc.cmd
to all users:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor" /v "AutoRun" /t REG_SZ /d "if exist %USERPROFILE%\.cmdrc.cmd %USERPROFILE%\.cmdrc.cmd"
- Or apply to the current user only:
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor" /v "AutoRun" /t REG_SZ /d "if exist %USERPROFILE%\.cmdrc.cmd %USERPROFILE%\.cmdrc.cmd"
- Apply
-
Add the following content to the file
%USERPROFILE%\.cmdrc.cmd
:
@echo off && termproxy init cmd -o "%TEMP%/proxy.cmd" && call "%TEMP%/proxy.cmd" && @echo on
Elvish
Add the following line to your ~/.elvish/rc.elv
:
eval (termproxy init elvish)
Fish
Add the following line to your ~/.config/fish/config.fish
:
termproxy init fish | source
Ion
Add the following line to your ~/.config/ion/initrc
:
eval $(termproxy init ion)
Nu
- Add the following line to
$nu.env-path
:
# Create `.cache` directory first if it doesn't exist
termproxy init nu -o ~/.cache/__proxy.nu
- Add the following line to your
$nu.config-path
:
use ~/.cache/__proxy.nu
PowerShell
Add the following line to your $PROFILE
:
Invoke-Expression (termproxy init powershell | Out-String)
Tcsh
Add the following line to your ~/.cshrc
:
eval `termproxy init tcsh`
Xonsh
Add the following line to your ~/.xonshrc
:
execx($(termproxy init xonsh))
Zsh
Add the following line to your ~/.zshrc
:
eval "$(termproxy init zsh)"
- There is no real standard for the
no_proxy
environment variable. So we follow the behavior ofcurl
.- Windows: wildcard domains and wildcard ips on windows will be converted into stripped domains and CIDRs, and wildcard forms like
www.*.com
,192.168.*.1
might not work.
- Windows: wildcard domains and wildcard ips on windows will be converted into stripped domains and CIDRs, and wildcard forms like
- Using
sudo
If you are using sudo
to run a command, you can use the -E
option to preserve the environment variables, or you can specify the environment variables you want to preserve in /etc/sudoers
:
Defaults env_keep += "http_proxy https_proxy all_proxy no_proxy"
- Add support for
macos
- Publish to scoop, brew and aur.