-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdinitctl.fish
More file actions
79 lines (67 loc) · 5.56 KB
/
Copy pathdinitctl.fish
File metadata and controls
79 lines (67 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Fish completions for dinitctl
# Helper to list services from /etc/dinit.d/
function __dinitctl_services
ls /etc/dinit.d/ 2>/dev/null | grep -v '^boot\.d$\|^config$\|^user$'
end
# Helper to list dep types for add-dep/rm-dep
function __dinitctl_dep_types
echo -e "regular\tmilestone\nwaits-for"
end
# Subcommands that take a single service name
set -l single_service_cmds status is-started is-failed unpin unload reload trigger untrigger catlog
# Subcommands that take a single service name + command options
set -l service_opts_cmds start stop restart wake release
# Do not complete files
complete -c dinitctl -f
# ── General options ────────────────────────────────────────────────────────────
complete -c dinitctl -n '__fish_use_subcommand' -l help -d 'Show help'
complete -c dinitctl -n '__fish_use_subcommand' -s s -l system -d 'Control system daemon'
complete -c dinitctl -n '__fish_use_subcommand' -s u -l user -d 'Control user daemon'
complete -c dinitctl -n '__fish_use_subcommand' -l quiet -d 'Suppress output except errors'
complete -c dinitctl -n '__fish_use_subcommand' -s p -l socket-path -r -d 'Socket path for daemon communication'
complete -c dinitctl -n '__fish_use_subcommand' -l use-passed-cfd -d 'Use socket fd from DINIT_CS_FD'
complete -c dinitctl -n '__fish_use_subcommand' -s o -l offline -d 'Do not contact running dinit daemon'
complete -c dinitctl -n '__fish_use_subcommand' -s d -l services-dir -r -d 'Directory for service definitions (offline)'
# ── Subcommands ────────────────────────────────────────────────────────────────
complete -c dinitctl -n '__fish_use_subcommand' -a status -d 'Show service status'
complete -c dinitctl -n '__fish_use_subcommand' -a is-started -d 'Check if service is started'
complete -c dinitctl -n '__fish_use_subcommand' -a is-failed -d 'Check if service is failed'
complete -c dinitctl -n '__fish_use_subcommand' -a start -d 'Start a service'
complete -c dinitctl -n '__fish_use_subcommand' -a stop -d 'Stop a service'
complete -c dinitctl -n '__fish_use_subcommand' -a restart -d 'Restart a service'
complete -c dinitctl -n '__fish_use_subcommand' -a wake -d 'Wake a service'
complete -c dinitctl -n '__fish_use_subcommand' -a release -d 'Release a service'
complete -c dinitctl -n '__fish_use_subcommand' -a unpin -d 'Unpin a service'
complete -c dinitctl -n '__fish_use_subcommand' -a unload -d 'Unload a service'
complete -c dinitctl -n '__fish_use_subcommand' -a reload -d 'Reload a service'
complete -c dinitctl -n '__fish_use_subcommand' -a list -d 'List all services'
complete -c dinitctl -n '__fish_use_subcommand' -a shutdown -d 'Shut down the system'
complete -c dinitctl -n '__fish_use_subcommand' -a add-dep -d 'Add a dependency between services'
complete -c dinitctl -n '__fish_use_subcommand' -a rm-dep -d 'Remove a dependency between services'
complete -c dinitctl -n '__fish_use_subcommand' -a enable -d 'Enable a service at boot'
complete -c dinitctl -n '__fish_use_subcommand' -a disable -d 'Disable a service at boot'
complete -c dinitctl -n '__fish_use_subcommand' -a trigger -d 'Trigger a service'
complete -c dinitctl -n '__fish_use_subcommand' -a untrigger -d 'Untrigger a service'
complete -c dinitctl -n '__fish_use_subcommand' -a setenv -d 'Set environment variable(s)'
complete -c dinitctl -n '__fish_use_subcommand' -a unsetenv -d 'Unset environment variable(s)'
complete -c dinitctl -n '__fish_use_subcommand' -a catlog -d 'Print service log'
complete -c dinitctl -n '__fish_use_subcommand' -a signal -d 'Send signal to a service'
# ── Service name completion ────────────────────────────────────────────────────
complete -c dinitctl -n "__fish_seen_subcommand_from $single_service_cmds $service_opts_cmds enable disable signal" \
-a '(__dinitctl_services)'
# ── Command options for start / stop / restart / wake / release ───────────────
complete -c dinitctl -n "__fish_seen_subcommand_from $service_opts_cmds" \
-l no-wait -d 'Do not wait for startup/shutdown to complete'
complete -c dinitctl -n "__fish_seen_subcommand_from $service_opts_cmds" \
-l pin -d 'Pin service in requested state'
complete -c dinitctl -n "__fish_seen_subcommand_from stop" \
-l force -d 'Force stop even if dependents are affected'
# ── enable / disable --from ───────────────────────────────────────────────────
complete -c dinitctl -n '__fish_seen_subcommand_from enable disable' \
-l from -r -a '(__dinitctl_services)' -d 'From service'
# ── add-dep / rm-dep ──────────────────────────────────────────────────────────
complete -c dinitctl -n '__fish_seen_subcommand_from add-dep rm-dep' \
-a '(__dinitctl_dep_types)'
# ── signal -l / --list ────────────────────────────────────────────────────────
complete -c dinitctl -n '__fish_seen_subcommand_from signal' \
-s l -l list -d 'List supported signals'