File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -287,9 +287,9 @@ cmd_on() {
287287 if [ " $system_proxy_degraded " = " true" ]; then
288288 ui_warn " 当前通过 clashctl 子进程执行,不能修改当前 Shell 代理变量"
289289 else
290- ui_warn " 当前通过 clashctl 子进程执行,已开启系统代理,但不会修改当前 Shell 代理变量 "
290+ ui_warn " 当前通过 clashctl 子进程执行,已开启系统代理,但不会修改当前终端的 Shell 变量 "
291291 fi
292- ui_next " 需要当前 Shell 立即生效: source shell 入口后执行 clashon,或重新打开终端 "
292+ ui_next " 当前终端如需立即生效:重新打开终端后使用 clashon,或手动 source shell 入口 "
293293 ui_blank
294294 fi
295295
Original file line number Diff line number Diff line change @@ -2436,6 +2436,8 @@ EOF
24362436 for shell_rc in " $HOME /.bashrc" " $HOME /.zshrc" " $HOME /.profile" ; do
24372437 install_rc_source_block " $shell_rc " " $profile_file "
24382438 done
2439+
2440+ install_alias_command_wrappers
24392441}
24402442
24412443remove_clashctl_entry () {
@@ -2925,4 +2927,8 @@ print_install_summary() {
29252927 if [ -f " $clashctl_file " ]; then
29262928 CLASH_UI_BOX_ONLY=1 bash " $clashctl_file " ui || true
29272929 fi
2930+
2931+ echo
2932+ echo " 💡 clashon / clashoff 为 shell 快捷入口;新终端会自动生效"
2933+ echo " 💡 当前终端若暂不可用,请先使用 clashctl on / clashctl off"
29282934}
Original file line number Diff line number Diff line change @@ -365,14 +365,24 @@ proxy_group_select() {
365365 local node=" $2 "
366366 local base secret
367367 local code response_file response_body
368+ local available_node found
368369
369370 [ -n " ${group:- } " ] || die " 策略组名称不能为空"
370371 [ -n " ${node:- } " ] || die " 节点名称不能为空"
371372
372373 proxy_group_exists " $group " || die " 策略组不存在:$group "
373374 proxy_group_is_selector " $group " || die " 该策略组不支持手动切换:$group "
374375
375- if ! proxy_group_selectable_nodes " $group " | grep -Fxq " $node " ; then
376+ found=false
377+ while IFS= read -r available_node; do
378+ [ -n " ${available_node:- } " ] || continue
379+ if [ " $available_node " = " $node " ]; then
380+ found=true
381+ break
382+ fi
383+ done < <( proxy_group_selectable_nodes " $group " )
384+
385+ if [ " $found " != " true" ]; then
376386 die " 节点不存在于策略组中:$group -> $node "
377387 fi
378388
You can’t perform that action at this time.
0 commit comments