From 44e1ffa9741743264b172aa27360c9b2892123cd Mon Sep 17 00:00:00 2001 From: libm Date: Wed, 23 Jul 2025 17:34:14 +0800 Subject: [PATCH] fix: optimize fish func to fix #189, #197 --- install.sh | 1 + script/clashctl.fish | 33 +++++++++++++++++++++++++++++++-- script/clashctl.sh | 4 ++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 8f3a463..1c0a61f 100755 --- a/install.sh +++ b/install.sh @@ -54,4 +54,5 @@ clashui _okcat '🎉' 'enjoy 🎉' clash # shellcheck disable=SC2016 +[ "$SUDO_USER" != 'root' ] && _okcat '请执行 clashon 开启代理环境' _quit diff --git a/script/clashctl.fish b/script/clashctl.fish index 77e49a2..1ff07ac 100644 --- a/script/clashctl.fish +++ b/script/clashctl.fish @@ -4,8 +4,6 @@ clashctl \ mihomo \ mihomoctl \ \ -clashon \ -clashoff \ clashui \ clashstatus \ clashsecret \ @@ -20,4 +18,35 @@ for fn in $fn_arr "function $fn bash -i -c '$fn \$@;exec fish -i' -- \$argv end" +end + +function clashon + bash -i -c 'clashon; sudo tee /var/proxy >/dev/null <