fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
fa74d0fe5
master
1set -l systemd_version( systemctl --version| string match"systemd*" | string replace -r"\D*(\d+)\D.*" '$1' ) 2set -l commands list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart\ 3 isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help\ 4 reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link list-jobs cancel\ 5 list-dependencies daemon-reload daemon-reexec show-environment set-environment unset-environment\ 6 default rescue emergency halt poweroff reboot kexec exit suspend suspend-then-hibernate hibernate hybrid-sleep switch-root\ 7 list-timers set-property import-environment get-default list-automounts is-system-running try-reload-or-restart freeze\ 8 thaw mount-image bind clean set-default cat list-machines preset-all add-wants add-requires edit 9if test $systemd_version -gt 243 2> /dev/null 10set commands$commands log-level log-target service-watchdogs 11end 12if test $systemd_version -gt 246 2> /dev/null 13set commands$commands service-log-level service-log-target 14end 15if test $systemd_version -gt 253 2> /dev/null 16set commands$commands list-paths soft-reboot whoami 17end 18if test $systemd_version -gt 255 2> /dev/null 19set commands$commands sleep 20end 21 22set -l types services sockets mounts service_paths targets automounts timers 23 24function __fish_systemd_properties 25# We need to call the main systemd binary (the thing that is run as PID1). 26# Unfortunately, it's usually not in $PATH. 27if test -f /usr/lib/systemd/systemd 28/usr/lib/systemd/systemd --dump-configuration-items| string replace -rf'(.+)=(.+)$' '$1\t$2' 29else if test -f /lib/systemd/systemd# Debian has not merged /lib and /usr/lib 30/lib/systemd/systemd --dump-configuration-items| string replace -rf'(.+)=(.+)$' '$1\t$2' 31end 32end 33 34# All systemctl commands 35complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a" $commands " 36 37#### Units commands 38complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a add-requires -d'Add Requires dependencies to a target unit' 39complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a add-wants -d'Add Wants dependencies to a target unit' 40complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a bind -d'Bind mount a path into the mount namespace of a unit' 41complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a cancel -d'Cancel one or more jobs' 42complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a cat -d'Show the backing files of one or more units' 43complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a clean -d'Remove config/state/logs for the given units' 44complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a daemon-reload -d'Reload the configuration of the system manager' 45complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a default -d'Enter and isolate the default mode' 46complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a disable -d'Disable one or more units' 47complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a edit -d'Edit a unit file or drop-in snippet' 48complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a enable -d'Enable one or more units' 49complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a emergency -d'Enter and isolate emergency mode' 50complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a exit -d'Ask the service manager to exit' 51complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a freeze -d'Freeze units with the cgroup freezer' 52complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a get-default -d'Show the default target to boot into' 53complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a help -d'Show the manual page for a unit' 54complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a import-environment -d'Import environment variables into the service manager' 55complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a isolate -d'Start a unit and dependencies and disable all others' 56complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a is-system-running -d'Return if system is running/starting/degraded' 57complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a kexec -d'Reboot via kexec' 58complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a kill -d'Kill one or more units' 59complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a link -d'Link a unit file into the unit search path' 60complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a list-automounts -d'List automount units' 61complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a list-machines -d'List the host and all running local containers' 62complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a mask -d'Prevent one or more units from starting' 63complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a mount-image -d'Mount an image into the mount namespace of a unit' 64complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a preset -d'Enable/disable a unit depending on preset configuration' 65complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a preset-all -d'Enable/disable all units depending on preset configuration' 66complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a reenable -d'Disable the enable one or more units' 67complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a reload -d'Request a unit reload its configuration' 68complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a reload-or-restart -d'Reload units if supported or restart them' 69complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a rescue -d'Enter and isolate rescue mode' 70complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a restart -d'Restart one or more units' 71complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a set-default -d'Set the default target to boot into' 72complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a set-property -d'Sets one or more properties of a unit' 73complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a show -d'Show properties of one or more units, jobs, or the manager itself' 74complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a show-environment -d'Dump the systemd manager environment block' 75complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a soft-reboot -d'Reboot userspace' 76complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a start -d'Start one or more units' 77complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a status -d'Runtime status about one or more units' 78complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a stop -d'Stop one or more units' 79complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a thaw -d'Unfreeze frozen units' 80complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a try-reload-or-restart -d'Reload units if supported or restart them, if running' 81complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a unmask -d'Stop preventing one or more units from starting' 82complete -f -c systemctl -n"not __fish_seen_subcommand_from $commands " -a whoami -d'Query the unit that owns a process' 83 84# Command completion done via argparse. 85complete -c systemctl -a'(__fish_systemctl)' -f 86 87# These "--x=help" outputs always have lines like "Available unit types:". We use the fact that they end in a ":" to filter them out. 88complete -f -c systemctl -s t -l type -d'List of unit types' -xa'(systemctl --type=help --no-legend --no-pager | string match -v "*:")' 89complete -f -c systemctl -l state -d'List of unit states' -xa'(systemctl --state=help --no-legend --no-pager | string match -v "*:")' 90complete -f -c systemctl -s p -l property -a'(__fish_systemd_properties)' 91complete -f -c systemctl -s a -l all -d'Show all units or properties' 92complete -f -c systemctl -s r -l recursive -d'Show also units of local containers' 93complete -f -c systemctl -l reverse -d'Show reverse dependencies between units' 94complete -f -c systemctl -l after -d'Show units ordered before specified unit' -n"__fish_seen_subcommand_from list-dependencies" 95complete -f -c systemctl -l before -d'Show units ordered after specified unit' -n"__fish_seen_subcommand_from list-dependencies" 96complete -f -c systemctl -s l -l full -d'Do not ellipsize anything' 97complete -f -c systemctl -l show-types -d'Show the type of the socket' 98complete -f -c systemctl -l job-mode -d'How to deal with queued jobs' -xa'fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush' 99complete -f -c systemctl -s i -l ignore-inhibitors -d'Ignore inhibitor locks on shutdown or sleep' 100complete -f -c systemctl -s q -l quiet -d'Suppress output to STDOUT' 101complete -f -c systemctl -l no-block -d'Do not wait for the requested operation to finish' 102complete -f -c systemctl -l no-legend -d'Do not print header and footer' 103# system and user/global are mutually exclusive 104complete -f -c systemctl -l user -d'Talk to the service manager of the calling user' -n"not __fish_contains_opt system" 105complete -f -c systemctl -l system -d'Talk to the service manager of the system.' -n"not __fish_contains_opt system global" 106complete -c systemctl -l failed -d'List units in failed state' 107complete -f -c systemctl -l global -d'Enable or disable for all users' -n"not __fish_contains_opt system" 108complete -f -c systemctl -l no-wall -d'Do not send wall message before halt' 109complete -f -c systemctl -l no-reload -d'Do not reload daemon configuration' 110complete -f -c systemctl -l no-ask-password -d'Disable asking for password' 111complete -f -c systemctl -l kill-who -d'Send signal to which process' -xa'main control all' 112complete -f -c systemctl -s s -l signal -d'Which signal to send' -xa'SIGTERM SIGINT SIGSTOP SIGKILL SIGHUP SIGCONT' 113complete -f -c systemctl -s f -l force -d'Overwrite conflicting existing symlinks' 114# --root needs a path 115complete -r -c systemctl -l root -d'Use alternative root path' 116complete -f -c systemctl -l runtime -d'Make changes only temporarily' 117complete -f -r -c systemctl -s n -l lines -d'Number of journal lines to show' -a"(seq 1 1000)" 118complete -f -c systemctl -s o -l output -d'Control journal formatting' -xa'short short-monotonic verbose export json json-pretty json-sse cat' 119complete -f -c systemctl -l plain -d'list-dependencies flat, not as tree' 120complete -f -c systemctl -s H -l host -d'Execute the operation on a remote host' -a"(__fish_print_hostnames)" 121complete -x -c systemctl -s M -l machine -d'Execute operation on a VM or container' -a"(__fish_systemd_machines)" 122complete -f -c systemctl -s h -l help -d'Print a short help and exit' 123complete -f -c systemctl -l version -d'Print a short version and exit' 124complete -f -c systemctl -l no-pager -d'Do not pipe output into a pager' 125complete -f -c systemctl -l firmware-setup -n"__fish_seen_subcommand_from reboot" -d"Reboot to EFI setup" 126complete -f -c systemctl -l now -n"__fish_seen_subcommand_from enable" -d"Also start unit" 127complete -f -c systemctl -l now -n"__fish_seen_subcommand_from disable mask" -d"Also stop unit" 128 129# New options since systemd 242 130if test $systemd_version -ge 242 2> /dev/null 131complete -x -c systemctl -l boot-loader-entry -n"__fish_seen_subcommand_from halt poweroff reboot" -d"Boot into a specific boot loader entry on next boot" -a"(systemctl --boot-loader-entry=help --no-legend --no-pager 2>/dev/null)" 132complete -x -c systemctl -l boot-loader-menu -n"__fish_seen_subcommand_from halt poweroff reboot" -d"Boot into boot loader menu on next boot" 133end