mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 21:43:55 +08:00
systemctl completions: Add more unit types and commands
It should now support all unit types mentioned in systemd.unit(5)
This commit is contained in:
parent
3d163eb910
commit
33c0d93b20
|
@ -4,77 +4,72 @@ set -l commands list-units list-sockets start stop reload restart try-restart re
|
||||||
list-dependencies snapshot delete daemon-reload daemon-reexec show show-environment set-environment unset-environment \
|
list-dependencies snapshot delete daemon-reload daemon-reexec show show-environment set-environment unset-environment \
|
||||||
default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root
|
default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root
|
||||||
|
|
||||||
|
complete -f -e -c systemctl
|
||||||
# All systemctl commands
|
# All systemctl commands
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a 'list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump list-dependencies snapshot delete daemon-reload daemon-reexec show show-environment set-environment unset-environment default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a 'list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump list-dependencies snapshot delete daemon-reload daemon-reexec show show-environment set-environment unset-environment default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root'
|
||||||
|
|
||||||
#### Units commands
|
#### Units commands
|
||||||
# Start
|
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a start -d 'Start one or more units'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a start -d 'Start one or more units'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from start' -a '(__fish_systemctl_services)' -d 'Service'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from start' -a '(__fish_systemctl_sockets)' -d 'Socket'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from start' -a '(__fish_systemctl_mounts)' -d 'Mount'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from start' -a '(__fish_systemctl_service_paths)' -d 'Path'
|
|
||||||
# Stop
|
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a stop -d 'Stop one or more units'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a stop -d 'Stop one or more units'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from stop' -a '(__fish_systemctl_services)' -d 'Service'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from stop' -a '(__fish_systemctl_sockets)' -d 'Socket'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from stop' -a '(__fish_systemctl_mounts)' -d 'Mount'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from stop' -a '(__fish_systemctl_service_paths)' -d 'Path'
|
|
||||||
# Restart
|
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a restart -d 'Restart one or more units'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a restart -d 'Restart one or more units'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from restart' -a '(__fish_systemctl_services)' -d 'Service'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from restart' -a '(__fish_systemctl_sockets)' -d 'Socket'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from restart' -a '(__fish_systemctl_mounts)' -d 'Mount'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from restart' -a '(__fish_systemctl_service_paths)' -d 'Path'
|
|
||||||
# Status
|
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a status -d 'Runtime status about one or more units'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a status -d 'Runtime status about one or more units'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from status' -a '(__fish_systemctl_services)' -d 'Service'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from status' -a '(__fish_systemctl_sockets)' -d 'Socket'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from status' -a '(__fish_systemctl_mounts)' -d 'Mount'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from status' -a '(__fish_systemctl_service_paths)' -d 'Path'
|
|
||||||
# Enable
|
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a enable -d 'Enable one or more units'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a enable -d 'Enable one or more units'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from enable' -a '(__fish_systemctl_services)' -d 'Service'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from enable' -a '(__fish_systemctl_sockets)' -d 'Socket'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from enable' -a '(__fish_systemctl_mounts)' -d 'Mount'
|
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from enable' -a '(__fish_systemctl_service_paths)' -d 'Path'
|
|
||||||
# Disable
|
|
||||||
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a disable -d 'Disable one or more units'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a disable -d 'Disable one or more units'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from disable' -a '(__fish_systemctl_services)' -d 'Service'
|
for command in start stop restart status enable disable
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from disable' -a '(__fish_systemctl_sockets)' -d 'Socket'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_services)' -d 'Service'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from disable' -a '(__fish_systemctl_mounts)' -d 'Mount'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_sockets)' -d 'Socket'
|
||||||
complete -f -c systemctl -n '__fish_seen_subcommand_from disable' -a '(__fish_systemctl_service_paths)' -d 'Path'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_mounts)' -d 'Mount'
|
||||||
complete -c systemctl -s t -l type -d 'List of unit types' -xa 'help service, mount, socket, target,'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_service_paths)' -d 'Path'
|
||||||
complete -c systemctl -l state -d 'List of unit states' -xa 'LOAD, SUB, ACTIVE,'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_targets)' -d 'Target'
|
||||||
complete -c systemctl -s p -l property -d 'Properties displayed in the "show" command'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_automounts)' -d 'Automount'
|
||||||
complete -c systemctl -s a -l all -d 'Show all units or properties'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from $command" -a '(__fish_systemctl_timers)' -d 'Timer'
|
||||||
complete -c systemctl -s r -l recursive -d 'Show also units of local containers'
|
end
|
||||||
complete -c systemctl -l reverse -d 'Show reverse dependencies between units'
|
|
||||||
complete -c systemctl -l after -d 'Show units ordered before specified unit'
|
# These are useless for the other commands
|
||||||
complete -c systemctl -l before -d 'Show units ordered after specified unit'
|
# .device in particular creates too much noise
|
||||||
complete -c systemctl -s l -l full -d 'Do not ellipsize anything'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from status" -a '(__fish_systemctl_devices)' -d 'Device'
|
||||||
complete -c systemctl -l show-types -d 'Show the type of the socket'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from status" -a '(__fish_systemctl_slices)' -d 'Slice'
|
||||||
complete -c systemctl -l job-mode -d 'How to deal with queued jobs' -xa 'fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from status" -a '(__fish_systemctl_scopes)' -d 'Scope'
|
||||||
complete -c systemctl -s i -l ignore-inhibitors -d 'Ignore inhibitor locks on shutdown or sleep'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from status" -a '(__fish_systemctl_swaps)' -d 'Swap'
|
||||||
complete -c systemctl -s q -l quiet -d 'Suppress output to STDOUT'
|
|
||||||
complete -c systemctl -l no-block -d 'Do not wait for the requested operation to finish'
|
complete -f -c systemctl -n "not __fish_seen_subcommand_from $commands" -a isolate -d 'Disable one or more units'
|
||||||
complete -c systemctl -l no-legend -d 'Do not print header and footer'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from isolate" -a '(__fish_systemctl_targets)' -d 'Target'
|
||||||
complete -c systemctl -l user -d 'Talk to the service manager of the calling user'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from isolate" -a '(__fish_systemctl_snapshots)' -d 'Snapshot'
|
||||||
complete -c systemctl -l system -d 'Talk to the service manager of the system.'
|
|
||||||
complete -c systemctl -l no-wall -d 'Do not send wall message before halt'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from set-default" -a '(__fish_systemctl_targets)' -d 'Target'
|
||||||
complete -c systemctl -l global -d 'Enable or disable for all users'
|
complete -f -c systemctl -n "__fish_seen_subcommand_from set-default" -a '(__fish_systemctl_services)' -d 'Service'
|
||||||
complete -c systemctl -l no-reload -d 'Do not reload daemon configuration'
|
|
||||||
complete -c systemctl -l no-ask-password -d 'Disable asking for password'
|
complete -f -c systemctl -s t -l type -d 'List of unit types' -xa 'help service, mount, socket, target,'
|
||||||
complete -c systemctl -l kill-who -d 'Send signal to which process' -xa 'main control all'
|
complete -f -c systemctl -l state -d 'List of unit states' -xa 'LOAD, SUB, ACTIVE,'
|
||||||
complete -c systemctl -s s -l signal -d 'Which signal to send' -xa 'SIGTERM SIGINT SIGSTOP SIGKILL SIGHUP SIGCONT'
|
complete -f -c systemctl -s p -l property -d 'Properties displayed in the "show" command'
|
||||||
complete -c systemctl -s f -l force -d 'Overwrite conflicting existing symlinks'
|
complete -f -c systemctl -s a -l all -d 'Show all units or properties'
|
||||||
complete -c systemctl -l root -d 'Use alternative root path'
|
complete -f -c systemctl -s r -l recursive -d 'Show also units of local containers'
|
||||||
complete -c systemctl -l runtime -d 'Make changes only temporarily'
|
complete -f -c systemctl -l reverse -d 'Show reverse dependencies between units'
|
||||||
complete -c systemctl -s n -l lines -d 'Number of journal lines to show'
|
complete -f -c systemctl -l after -d 'Show units ordered before specified unit'
|
||||||
complete -c systemctl -s o -l output -d 'Control journal formatting' -xa 'short short-monotonic verbose export json json-pretty json-sse cat'
|
complete -f -c systemctl -l before -d 'Show units ordered after specified unit'
|
||||||
complete -c systemctl -l plain -d 'list-dependencies flat, not as tree'
|
complete -f -c systemctl -s l -l full -d 'Do not ellipsize anything'
|
||||||
complete -c systemctl -s H -l host -d 'Execute the operation remotely'
|
complete -f -c systemctl -l show-types -d 'Show the type of the socket'
|
||||||
complete -c systemctl -s M -l machine -d 'Execute operation locally'
|
complete -f -c systemctl -l job-mode -d 'How to deal with queued jobs' -xa 'fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush'
|
||||||
complete -c systemctl -s h -l help -d 'Print a short help and exit'
|
complete -f -c systemctl -s i -l ignore-inhibitors -d 'Ignore inhibitor locks on shutdown or sleep'
|
||||||
complete -c systemctl -l version -d 'Print a short version and exit'
|
complete -f -c systemctl -s q -l quiet -d 'Suppress output to STDOUT'
|
||||||
complete -c systemctl -l no-pager -d 'Do not pipe output into a pager'
|
complete -f -c systemctl -l no-block -d 'Do not wait for the requested operation to finish'
|
||||||
|
complete -f -c systemctl -l no-legend -d 'Do not print header and footer'
|
||||||
|
complete -f -c systemctl -l user -d 'Talk to the service manager of the calling user'
|
||||||
|
complete -f -c systemctl -l system -d 'Talk to the service manager of the system.'
|
||||||
|
complete -f -c systemctl -l no-wall -d 'Do not send wall message before halt'
|
||||||
|
complete -f -c systemctl -l global -d 'Enable or disable for all users'
|
||||||
|
complete -f -c systemctl -l no-reload -d 'Do not reload daemon configuration'
|
||||||
|
complete -f -c systemctl -l no-ask-password -d 'Disable asking for password'
|
||||||
|
complete -f -c systemctl -l kill-who -d 'Send signal to which process' -xa 'main control all'
|
||||||
|
complete -f -c systemctl -s s -l signal -d 'Which signal to send' -xa 'SIGTERM SIGINT SIGSTOP SIGKILL SIGHUP SIGCONT'
|
||||||
|
complete -f -c systemctl -s f -l force -d 'Overwrite conflicting existing symlinks'
|
||||||
|
complete -f -c systemctl -l root -d 'Use alternative root path'
|
||||||
|
complete -f -c systemctl -l runtime -d 'Make changes only temporarily'
|
||||||
|
complete -f -c systemctl -s n -l lines -d 'Number of journal lines to show'
|
||||||
|
complete -f -c systemctl -s o -l output -d 'Control journal formatting' -xa 'short short-monotonic verbose export json json-pretty json-sse cat'
|
||||||
|
complete -f -c systemctl -l plain -d 'list-dependencies flat, not as tree'
|
||||||
|
complete -f -c systemctl -s H -l host -d 'Execute the operation remotely'
|
||||||
|
complete -f -c systemctl -s M -l machine -d 'Execute operation locally'
|
||||||
|
complete -f -c systemctl -s h -l help -d 'Print a short help and exit'
|
||||||
|
complete -f -c systemctl -l version -d 'Print a short version and exit'
|
||||||
|
complete -f -c systemctl -l no-pager -d 'Do not pipe output into a pager'
|
||||||
|
|
9
share/functions/__fish_systemctl_automounts.fish
Normal file
9
share/functions/__fish_systemctl_automounts.fish
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
function __fish_systemctl_automounts
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
systemctl --user list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-unit-files --no-legend --type=automount ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
share/functions/__fish_systemctl_devices.fish
Normal file
11
share/functions/__fish_systemctl_devices.fish
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
function __fish_systemctl_devices
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
# Devices are usually generated at runtime
|
||||||
|
# Therefore show known _units_, not unit-files
|
||||||
|
systemctl --user list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-units --no-legend --type=device ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
share/functions/__fish_systemctl_scopes.fish
Normal file
11
share/functions/__fish_systemctl_scopes.fish
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
function __fish_systemctl_scopes
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
# Scopes are usually generated at runtime
|
||||||
|
# Therefore show known _units_, not unit-files
|
||||||
|
systemctl --user list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-units --no-legend --type=scope ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
share/functions/__fish_systemctl_slices.fish
Normal file
11
share/functions/__fish_systemctl_slices.fish
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
function __fish_systemctl_slices
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
# Slices are usually generated at runtime
|
||||||
|
# Therefore show known _units_, not unit-files
|
||||||
|
systemctl --user list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-units --no-legend --type=slice ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
share/functions/__fish_systemctl_snapshots.fish
Normal file
12
share/functions/__fish_systemctl_snapshots.fish
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
function __fish_systemctl_snapshots
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
# Snapshots are usually generated at runtime
|
||||||
|
# Therefore show known _units_, not unit-files
|
||||||
|
# They are also often not loaded, so add "--all"
|
||||||
|
systemctl --user list-units --all --no-legend --type=snapshot ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-units --all --no-legend --type=snapshot ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
share/functions/__fish_systemctl_swaps.fish
Normal file
9
share/functions/__fish_systemctl_swaps.fish
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
function __fish_systemctl_swaps
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
systemctl --user list-unit-files --no-legend --type=swap ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-unit-files --no-legend --type=swap ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
share/functions/__fish_systemctl_targets.fish
Normal file
9
share/functions/__fish_systemctl_targets.fish
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
function __fish_systemctl_targets
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
systemctl --user list-unit-files --no-legend --type=target ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-unit-files --no-legend --type=target ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
share/functions/__fish_systemctl_timers.fish
Normal file
9
share/functions/__fish_systemctl_timers.fish
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
function __fish_systemctl_timers
|
||||||
|
if type -q systemctl
|
||||||
|
if __fish_contains_opt user
|
||||||
|
systemctl --user list-unit-files --no-legend --type=timer ^/dev/null | cut -f 1 -d ' '
|
||||||
|
else
|
||||||
|
systemctl list-unit-files --no-legend --type=timer ^/dev/null | cut -f 1 -d ' '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user