From 81ed5485974ed297024f0fbda8577e8067f14ad2 Mon Sep 17 00:00:00 2001 From: Artyom Titov Date: Wed, 9 Sep 2026 20:31:37 +0300 Subject: [PATCH] Added help page. --- nstart.zsh | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/nstart.zsh b/nstart.zsh index b7941ee..c1da506 100755 --- a/nstart.zsh +++ b/nstart.zsh @@ -1,5 +1,39 @@ #!/bin/zsh + show_help() { +print -P -- \ +"%BUsage:%b nstart + +Quickly connect to a NetworkManager profile and start Xray. + +nstart is intended for fast interactive use, replacing repetitive commands +such as %F{cyan}nmcli c u wifi%f followed by manually starting Xray. + +%BConfiguration:%b + %F{green}XRAY_CONFIG_FILE%f + Path to the Xray configuration file. + + %F{green}DEFAULT_CONNECTIONS_NM%f + Preferred NetworkManager connections. + + typeset -xT DEFAULT_CONNECTIONS_NM nmcli_def_conns + nmcli_def_conns=( wifi home work ) + +%BBehavior:%b + nstart first offers connections from DEFAULT_CONNECTIONS_NM. + If none is selected, it lets you choose from all profiles found by + %F{cyan}nmcli connection show%f. + + After NetworkManager connects successfully, Xray is started with: + + %F{cyan}xray run -c \"\$XRAY_CONFIG_FILE\"%f + +%BContributing:%b + Bugs, patches and improvements are welcome: + %F{blue}https://git.vpnpickup.com/artobyte/nstart%f" +} + + spinner() { local pid=$1 local text=$2 @@ -23,7 +57,8 @@ print_numbered_list() { } if [[ "$1" == "-h" || "$1" == "--help" ]]; then - + show_help + exit 0 fi connections=( ${(f)"$(nmcli --terse --fields NAME connection show)"} )