move wg0 alias to aliases file
This commit is contained in:
parent
84540f5b82
commit
2054fe49b8
|
@ -25,3 +25,18 @@ function mkcd { mkdir -p $1 && cd $1 }
|
||||||
if [ "$TERM_PROGRAM" = "vscode" ]; then
|
if [ "$TERM_PROGRAM" = "vscode" ]; then
|
||||||
alias code='code -r'
|
alias code='code -r'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# A function which toggles the status of a systemd service
|
||||||
|
function systemctl_toggle {
|
||||||
|
if systemctl is-active --quiet $1; then
|
||||||
|
sudo systemctl stop $1
|
||||||
|
else
|
||||||
|
sudo systemctl start $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Alias `wg0` to toggle the wg0 interface if registered via systemd
|
||||||
|
if command -v "wg-quick" 2>&1 >/dev/null; then
|
||||||
|
# User program: make `wg-quick up wg0` less of a pain
|
||||||
|
alias wg0="systemctl_toggle wg-quick@wg0.service"
|
||||||
|
fi
|
||||||
|
|
10
zsh/.zshrc
10
zsh/.zshrc
|
@ -23,13 +23,3 @@ export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
|
||||||
# User program: add 1password SSH utils
|
# User program: add 1password SSH utils
|
||||||
export PATH="$HOME/.1password-ssh-utils/bin:$PATH"
|
export PATH="$HOME/.1password-ssh-utils/bin:$PATH"
|
||||||
alias ssh="op-ssh-fetch -n && ssh"
|
alias ssh="op-ssh-fetch -n && ssh"
|
||||||
|
|
||||||
# User program: make `wg-quick up wg0` less of a pain
|
|
||||||
function systemctl_toggle {
|
|
||||||
if systemctl is-active --quiet $1; then
|
|
||||||
sudo systemctl stop $1
|
|
||||||
else
|
|
||||||
sudo systemctl start $1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
alias wg0="systemctl_toggle wg-quick@wg0.service"
|
|
||||||
|
|
Loading…
Reference in a new issue