From c9acb2bf4bef66a23552432a1008ff8c45535357 Mon Sep 17 00:00:00 2001 From: Erin Date: Wed, 18 Jan 2023 13:19:18 -0500 Subject: [PATCH] Add alias to toggle wg0 interface --- zsh/.zshrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zsh/.zshrc b/zsh/.zshrc index 7771c33..cc1c87e 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -23,3 +23,13 @@ export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" # User program: add 1password SSH utils export PATH="$HOME/.1password-ssh-utils/bin:$PATH" 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"