fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a9618477e
master
1function __fish_print_connman_services 2# connmanctl services follows this pattern (to be interpreted as a regex): 3# "[\* ][A ][ORacd ] service_name +identification_string" 4# where [\* ] indicates whether a service is a favorite 5# [A ] indicates whether a service is in autoconnect mode 6# [ORacd ] indicates the current status of the service: online, ready, association, configuration, disconnect or idle 7connmanctl services| string replace -r'.{4}(.*) +(.*)' '$2\t$1' 8end 9 10function __fish_print_connman_technologies 11connmanctl technologies| string match'*Type*' | string replace -r' Type = (.*)' '$1' 12end 13 14function __fish_print_connman_vpnconnections 15# formatting of the vpn connections: 16# " [RCF ] service_name +identification_string" 17# where [RCF ] indicates the current status which can be: ready, configuration, failure or idle 18connmanctl vpnconnections| string replace -r'.{4}(.*) +(.*)' '$2\t$1' 19end 20 21# connmanctl does not accept options before commands, so requiring the commands to be in second position is okay 22complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a state -d"Shows if the system is online or offline" 23complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a technologies -d"Display technologies" 24complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a clock -d"Get System Clock Properties" 25complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a enable -d"Enables given technology or offline mode" 26complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] enable" -a"(__fish_print_connman_technologies) offline" 27complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a disable -d"Disables given technology or offline mode" 28complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] disable" -a"(__fish_print_connman_technologies) offline" 29complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a tether -d"Enable, disable tethering, set SSID and passphrase for wifi" 30complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] tether" -a"(__fish_print_connman_technologies)" 31complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 3; and contains -- (commandline -xpc)[2] tether" -a"on off" 32complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a services -d"Display services" 33complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] services" -a"(__fish_print_connman_services)" 34complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a peers -d"Display peers" 35complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a scan -d"Scans for new services for given technology" 36complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] scan" -a"(__fish_print_connman_technologies)" 37complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a connect -d"Connect a given service or peer" 38complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] connect" -a"(__fish_print_connman_services)" 39complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a disconnect -d"Disconnect a given service or peer" 40complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] disconnect" -a"(__fish_print_connman_services)" 41complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a config -d"Set service configuration options" 42complete -f -c connmanctl -n"test (count (commandline -xpc)) -ge 2; and contains -- (commandline -xpc)[2] config" -a"(__fish_print_connman_services)" 43complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a monitor -d"Monitor signals from interfaces" 44complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a vpnconnections -d"Display VPN connections" 45complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] vpnconnections" -a"(__fish_print_connman_vpnconnections)" 46complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a session -d"Enable or disable a session" 47complete -f -c connmanctl -n"test (count (commandline -xpc)) -eq 2; and contains -- (commandline -xpc)[2] session" -a"on off connect disconnect config" 48complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a peer_service -d"(Un)Register a Peer Service" 49complete -f -c connmanctl -n"test (count (commandline -xpc)) -lt 2" -a help -d"Show help"