Added help page.

This commit is contained in:
Artyom Titov 2026-09-09 20:31:37 +03:00
commit 81ed548597

View file

@ -1,5 +1,39 @@
#!/bin/zsh #!/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() { spinner() {
local pid=$1 local pid=$1
local text=$2 local text=$2
@ -23,7 +57,8 @@ print_numbered_list() {
} }
if [[ "$1" == "-h" || "$1" == "--help" ]]; then if [[ "$1" == "-h" || "$1" == "--help" ]]; then
show_help
exit 0
fi fi
connections=( ${(f)"$(nmcli --terse --fields NAME connection show)"} ) connections=( ${(f)"$(nmcli --terse --fields NAME connection show)"} )