fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a766c44a1
master
1# Completions for networkctl (a part of systemd) 2 3set -l command_with_devices list status lldp delete up down renew forcerenew reconfigure 4set -l command_with_config_devices edit cat 5set -l command_with_config_files mask unmask$command_with_config_devices 6set -l commands label reload$command_with_devices $command_with_config_files 7set -l devices"(networkctl list --no-legend 2>/dev/null | string trim | string split -f 2 -- ' ')" 8set -l config_devices"(networkctl list --no-legend 2>/dev/null | string trim | string split -f 2 -- ' ' | string replace -r -- '^' '@')" 9 10function __fish_complete_networkctl_files 11set -l dirs /etc/systemd/network /run/systemd/network /usr/local/lib/systemd/network /usr/lib/systemd/network 12set -l exts link netdev network 13 14for dirin $dirs 15for extin $exts 16path basename$dir /*.$ext 17end 18end 19end 20 21# Commands 22complete -c networkctl -f 23complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a list -d"List links" 24complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a status -d"Show link status" 25complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a lldp -d"Show LLDP neighbors" 26complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a label -d"Show current address label" 27complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a delete -d"Delete virtual netdevs" 28complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a up -d"Bring devices up" 29complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a down -d"Bring devices down" 30complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a renew -d"Renew dynamic configurations" 31complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a forcerenew -d"Trigger DHCP reconfiguration of all connected clients" 32complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a reconfigure -d"Reconfigure interfaces" 33complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a reload -d"Reload .network and .netdev files" 34complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a edit -d"Edit network configuration files" 35complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a cat -d"Show network configuration files" 36complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a mask -d"Mask network configuration files" 37complete -c networkctl -n"not __fish_seen_subcommand_from $commands " -a unmask -d"Unmask network configuration files" 38complete -c networkctl -n"__fish_seen_subcommand_from $command_with_devices " -a" $devices " 39complete -c networkctl -n"__fish_seen_subcommand_from $command_with_config_files " -xa"(__fish_complete_networkctl_files) $config_devices " 40 41# Options 42complete -c networkctl -s h -l help -d"Show help" 43complete -c networkctl -l version -d"Show version" 44complete -c networkctl -l no-pager -d"Do not pipe output into a pager" 45complete -c networkctl -l no-legend -d"Do not show the headers and footers" 46complete -c networkctl -l no-ask-password -d"Do no prompt for password" 47complete -c networkctl -s a -l all -d"Show status for all links" 48complete -c networkctl -s s -l stats -d"Show detailed link statics" 49complete -c networkctl -s l -l full -d"Do not ellipsize output" 50complete -c networkctl -s n -l lines -d"Number of journal entries to show" -xa"(seq 1 10)" 51complete -c networkctl -l json -d"Generate JSON output" -xa"pretty short off" 52complete -c networkctl -l no-reload -d"Do not reload systemd-networkd or systemd-udevd" 53complete -c networkctl -l drop-in -d"Edit specified drop-in instead of main file" -x 54complete -c networkctl -l runtime -d"Edit runtime config file" 55complete -c networkctl -l stdin -d"Read new contents of edited file from stdin"