From 66fbb26ccc29d9232430e2b2dc2cf22391e93ae2 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Sun, 25 Sep 2022 21:22:18 +0200 Subject: [PATCH] Add wg() function --- zsh/.config/zsh/functions.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index d0c008f..386e84a 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -59,3 +59,14 @@ open() { fi } +wg() { + (( ${+commands[wg]} )) && (( ${+commands[wg-quick]} )) || return 2 + + if [[ $1 == up ]]; then + sudo wg-quick up $2 + elif [[ $1 == down ]]; then + sudo wg-quick down $2 + else + command wg "$@" + fi +}