fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
0df6fa791
master
1set -l cmds list start stop switch-to enable disable enable-all disable-all is-active is-enabled 2 3# Helper function that prints network profiles managed by netctl-auto. 4# If no argument is given, it prints all profiles. 5# Otherwise, it only prints the ones given as arguments witch are either: 6# - active 7# - disabled 8# - other (meaning enabled but not active) 9# 10# For example, if you only want the enabled profiles, call it with 11# the arguments active and other. 12function __fish_print_netctl-auto_profile 13set -l show_active false 14set -l show_disabled false 15set -l show_other false 16 17for argin $argv 18switch $arg 19case other 20set show_other true 21case disabled 22set show_disabled true 23case active 24set show_active true 25end 26end 27 28if not count $argv > /dev/null 29set show_active true 30set show_disabled true 31set show_other true 32end 33 34for linein ( netctl-auto list) 35set -l profile( string sub -s3 $line ) 36if string match -q'\**' --$line 37if test $show_active = true 38printf "%s\t%s\n" $profile "Active profile" 39end 40else if string match -q"!*" --$line 41if test $show_disabled = true 42printf "%s\t%s\n" $profile "Disabled profile" 43end 44else 45if test $show_other = true 46printf "%s\t%s\n" $profile Profile 47end 48end 49end 50end 51 52complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -l help -d"Show help" 53complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -l version -d"Show version" 54complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a list -f -d"List all available profiles for automatic selection" 55complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a start -f -d"Start automatic profile selection on interface" 56complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a stop -f -d"Stop automatic profile selection on interface" 57complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a switch-to -f -d"Switch to the given network profile" 58complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a enable -f -d"Enable network profile for automatic selection" 59complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a disable -f -d"Disable network profile for automatic selection" 60complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a enable-all -f -d"Enable all profiles for automatic selection" 61complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a disable-all -f -d"Disable all profiles for automatic selection" 62complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a is-active -f -d"Check whether specified profile is active" 63complete -c netctl-auto -n"not __fish_seen_subcommand_from $cmds " -a is-enabled -f -d"Check whether specified profile is enabled" 64 65complete -c netctl-auto -n"__fish_seen_subcommand_from switch-to" -f -a"(__fish_print_netctl-auto_profile other disabled)" -d Profile 66complete -c netctl-auto -n"__fish_seen_subcommand_from enable" -f -a"(__fish_print_netctl-auto_profile disabled)" -d Profile 67complete -c netctl-auto -n"__fish_seen_subcommand_from disable" -f -a"(__fish_print_netctl-auto_profile active other)" -d Profile 68complete -c netctl-auto -n"__fish_seen_subcommand_from start stop" -f -a"(__fish_print_interfaces)" 69complete -c netctl-auto -n"__fish_seen_subcommand_from is-enabled is-active" -x -a"(__fish_print_netctl-auto_profile active disabled other)"