Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] startup: add completion for fish shell
@ 2021-09-06  7:17 maxice8
  2021-09-06  7:35 ` [PR PATCH] [Updated] " maxice8
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: maxice8 @ 2021-09-06  7:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

There is a new pull request by maxice8 against master on the void-packages repository

https://github.com/maxice8/void-packages startup
https://github.com/void-linux/void-packages/pull/32854

startup: add completion for fish shell
upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41


A patch file from https://github.com/void-linux/void-packages/pull/32854.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-startup-32854.patch --]
[-- Type: text/x-diff, Size: 10990 bytes --]

From 95f4d63e7711f47e1bfde336cffa3599485cc7d6 Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Mon, 6 Sep 2021 07:14:57 +0000
Subject: [PATCH] startup: add completion for fish shell

upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41
---
 srcpkgs/startup/files/init-checkconf.fish |   7 ++
 srcpkgs/startup/files/initctl.fish        | 125 ++++++++++++++++++++++
 srcpkgs/startup/files/startup.fish        |  17 +++
 srcpkgs/startup/template                  |   7 +-
 4 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/startup/files/init-checkconf.fish
 create mode 100644 srcpkgs/startup/files/initctl.fish
 create mode 100644 srcpkgs/startup/files/startup.fish

diff --git a/srcpkgs/startup/files/init-checkconf.fish b/srcpkgs/startup/files/init-checkconf.fish
new file mode 100644
index 000000000000..d14b4b4b7054
--- /dev/null
+++ b/srcpkgs/startup/files/init-checkconf.fish
@@ -0,0 +1,7 @@
+# Global options
+complete -f -c init-checkconf -s d -l debug -d 'Show some debug output'
+complete -r -F -c init-checkconf -s f -l file -d 'Path to job configuration file to check'
+complete -r -F -c init-checkconf -s i -l initctl-path -d 'Path to initctl(8) binary'
+complete -f -c init-checkconf -s s -l noscript -d 'Do not check script sections'
+complete -r -F -c init-checkconf -s x -l startup-path -d 'Payh to startup(8) binary'
+complete -f -c init-checkconf -s h -l help -d 'Display usage statement'
diff --git a/srcpkgs/startup/files/initctl.fish b/srcpkgs/startup/files/initctl.fish
new file mode 100644
index 000000000000..0c5cc8a3445f
--- /dev/null
+++ b/srcpkgs/startup/files/initctl.fish
@@ -0,0 +1,125 @@
+# Global options
+complete -f -c initctl -l session -d 'Use existing session D-Bus session (for testing)'
+complete -f -c initctl -l system -d 'Use system D-Bus'
+complete -x -c initctl -l dest -d 'Name for the Startup daemon in system D-Bus'
+complete -f -c initctl -l user -d 'Run in user mode'
+complete -f -c initctl -s q -l quiet -d 'Only output errors'
+complete -f -c initctl -s v -l verbose -d 'Include informational messages'
+complete -f -c initctl -l help -d 'Show help'
+complete -f -c initctl -l version -d 'Output version information'
+
+# Job commands
+complete -f -c initctl -n __fish_use_subcommand -a start -d 'Start job'
+complete -f -c initctl -n __fish_use_subcommand -a stop -d 'Stop job'
+complete -f -c initctl -n __fish_use_subcommand -a restart -d 'Restart job'
+complete -f -c initctl -n __fish_use_subcommand -a reload -d 'Reload job'
+complete -f -c initctl -n __fish_use_subcommand -a status -d 'Query status of job'
+complete -f -c initctl -n __fish_use_subcommand -a list -d 'List known jobs'
+
+# Event commands
+complete -f -c initctl -n __fish_use_subcommand -a emit -d 'Emit an event'
+
+# Environment commands
+complete -f -c initctl -n __fish_use_subcommand -a get-env -d 'Retrieve value of a job environment variable'
+complete -f -c initctl -n __fish_use_subcommand -a list-env -d 'Show all job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a reset-env -d 'Revert all job environment variable changes'
+complete -f -c initctl -n __fish_use_subcommand -a set-env -d 'Set one or more job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a unset-env -d 'Remove one or more job environment variables'
+
+# Other commands
+complete -f -c initctl -n __fish_use_subcommand -a reload-configuration -d 'Reload init daemon configuration'
+complete -f -c initctl -n __fish_use_subcommand -a version -d 'Request version of the init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a log-priority -d 'Change minimum priority of log messages from init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a show-config -d 'Show emits, start on and stop on defaults for a job'
+complete -f -c initctl -n __fish_use_subcommand -a check-config -d 'Check for unreachable jobs/event conditions'
+complete -f -c initctl -n __fish_use_subcommand -a usage -d 'Show job usage message if available'
+complete -f -c initctl -n __fish_use_subcommand -a notify-cgroup-manager-address -d 'Inform Upstart of D-Bus address cgroup manager is available on'
+complete -f -c initctl -n __fish_use_subcommand -a notify-dbus-address -d 'Inform Upstart of D-Bus address to connect to'
+complete -f -c initctl -n __fish_use_subcommand -a notify-disk-writeable -d 'Inform Upstart that disk is now writeable'
+complete -f -c initctl -n __fish_use_subcommand -a list-sessions -d 'List all sessions'
+complete -f -c initctl -n __fish_use_subcommand -a re-exec -d 'Perform stateful re-exec'
+complete -f -c initctl -n __fish_use_subcommand -a help -d 'Display list of commands'
+
+# -n|--no-wait for some of the Job commands
+complete -f -c initctl -n "__fish_seen_subcommand_from start stop restart emit" -s n -l no-wait -d 'Do not wait for action to return'
+
+# -r|--retain for some of the Environment commands
+complete -f -c initctl -n "__fish_seen_subcommand_from set-env unset-env reset-env" -s r -l retain -d 'Do not modify already set variables'
+
+# Offer all 'stop/waiting' jobs with 'start' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from start" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+# Offer all 'start/*' jobs with 'stop', 'reload' and 'restart' subcommands
+complete -f -c initctl -n "__fish_seen_subcommand_from stop reload restart" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+# Offer all jobs with its status to the 'status' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from status" -a "(__fish_initctl_list_with_status)"
+
+# Offer all jobs to the 'check-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -a "(__fish_initctl_run list | string split ' ' -f 1)" -d Job
+
+# Offer all envs from 'list-env' subcommand to 'get-env' and 'unset-env'
+complete -f -c initctl -n "__fish_seen_subcommand_from get-env unset-env" -a "(__fish_initctl_run list-env | string replace -r '=' '\tVariable: ')"
+
+# Possible priority levels for 'log-priority' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from log-priority" -a "debug info message warn error fatal" -d 'Priority'
+
+# -e|--enumerate option for 'show-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from show-config" -s e -l enumerate -d 'Print per line each "start on" and "stop on" condition for each event or job'
+
+# -i|--ignore-events and -w|--warn for 'check-config' subcommand
+complete -x -c initctl -n "__fish_seen_subcommand_from check-config" -s i -l ignore-events -d 'Comma-separated list of events to ignore'
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -s w -l warn -d 'treat any unknown jobs and events as errors'
+
+# Show all the events from 'emits' in configuration to emit
+complete -x -c initctl -n "__fish_seen_subcommand_from emit" -a "(__fish_initctl_get_events)" -d 'Event'
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
+
+function __fish_initctl_extract_events -d 'Extract emitted events from job configuration'
+	grep -E '^[[:space:]]*emits ' $argv/*.conf \
+	| cut -d : -f 2- \
+	| string replace 'emit ' '' \
+	| string replace ' ' \n \
+	| sort -u
+end
+
+function __fish_initctl_get_events -d 'Print all events that jobs in the current context emit'
+	switch (__fish_initctl_context)
+		case system
+			set -l dirs /etc/startup /etc/init /usr/share/start /usr/share/xdg/startup
+			for d in (string replace : ' ' $XDG_CONFIG_DIRS)
+				set -l dirs $dirs $d/startup $d/upstart
+			end
+			__fish_initctl_extract_events $dirs
+		case user session
+			if set -q XDG_CONFIG_HOME
+				__fish_initctl_extract_events $XDG_CONFIG_HOME/startup $XDG_CONFIG_HOME/upstart
+			else
+				__fish_initctl_extract_events $HOME/.config/startup $HOME/.config/upstart
+			end
+	end
+end
diff --git a/srcpkgs/startup/files/startup.fish b/srcpkgs/startup/files/startup.fish
new file mode 100644
index 000000000000..56b0313cc1b1
--- /dev/null
+++ b/srcpkgs/startup/files/startup.fish
@@ -0,0 +1,17 @@
+# Options
+complete -r -F -c startup -l append-confdir -d 'Append directories to look for job configuration files'
+complete -r -F -c startup -l confdir -d 'Read job configurationo files from this directory rather than defaults'
+complete -x -c startup -l default-console -d 'Default value for "console" stanza'
+complete -f -c startup -l no-cgroups -d 'Do not honour cgroup stanza'
+complete -f -c startup -l no-dbus -d 'Do connect to a D-Bus bus'
+complete -f -c startup -l no-inherint-env -d 'Stop jobs from inheriting initial environment'
+complete -r -F -c startup -l logdir -d 'Write job output log files to this directory'
+complete -f -c startup -l no-log -d 'Disable logging of job output'
+complete -f -c startup -l no-session -d 'Disable chroot sessions'
+complete -f -c startup -l no-startup-event -d 'Do not emit initial startup event'
+complete -r -F -c startup -l prepend-confdir -d 'Prepend directories to look for job configuration files'
+complete -f -c startup -l session -d 'Connect to the D-Bus session bus'
+complete -x -c startup -l startup-event -d 'emit a different event at startup than the default one'
+complete -f -c starutp -s q -l quiet -d 'Only output errors'
+complete -f -c startup -s v -l verbose -d 'Output verbose messages about job state changes and event emissions'
+complete -f -c startup -l version -d 'Output version information and exit'
diff --git a/srcpkgs/startup/template b/srcpkgs/startup/template
index eeeee53501a1..d22228ecea90 100644
--- a/srcpkgs/startup/template
+++ b/srcpkgs/startup/template
@@ -1,7 +1,7 @@
 # Template file for 'startup'
 pkgname=startup
 version=2.0.2
-revision=3
+revision=4
 build_style=gnu-configure
 configure_args="--disable-sysvcompat --disable-dconf-bridge --disable-cgroups"
 make_dirs="/var/log/startup 0750 root adm"
@@ -22,6 +22,11 @@ pre_configure() {
 
 post_install() {
 	rm -f -- "${DESTDIR}/usr/lib/libupstart.la"
+
+	# Fish completion
+	vinstall ${FILESDIR}/startup.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/init-checkconf.fish 0644 /usr/share/fish/completions
 }
 
 startup-tools_package() {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] startup: add completion for fish shell
  2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
@ 2021-09-06  7:35 ` maxice8
  2021-09-06 23:20 ` maxice8
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: maxice8 @ 2021-09-06  7:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

There is an updated pull request by maxice8 against master on the void-packages repository

https://github.com/maxice8/void-packages startup
https://github.com/void-linux/void-packages/pull/32854

startup: add completion for fish shell
upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41


A patch file from https://github.com/void-linux/void-packages/pull/32854.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-startup-32854.patch --]
[-- Type: text/x-diff, Size: 12061 bytes --]

From 2305450b6df70eb38d498551a64be950f9e74c89 Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Mon, 6 Sep 2021 07:14:57 +0000
Subject: [PATCH] startup: add completion for fish shell

upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41
---
 srcpkgs/startup/files/init-checkconf.fish  |   7 ++
 srcpkgs/startup/files/initctl.fish         | 125 +++++++++++++++++++++
 srcpkgs/startup/files/startup-monitor.fish |   5 +
 srcpkgs/startup/files/startup.fish         |  17 +++
 srcpkgs/startup/template                   |   9 +-
 5 files changed, 162 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/startup/files/init-checkconf.fish
 create mode 100644 srcpkgs/startup/files/initctl.fish
 create mode 100644 srcpkgs/startup/files/startup-monitor.fish
 create mode 100644 srcpkgs/startup/files/startup.fish

diff --git a/srcpkgs/startup/files/init-checkconf.fish b/srcpkgs/startup/files/init-checkconf.fish
new file mode 100644
index 000000000000..d14b4b4b7054
--- /dev/null
+++ b/srcpkgs/startup/files/init-checkconf.fish
@@ -0,0 +1,7 @@
+# Global options
+complete -f -c init-checkconf -s d -l debug -d 'Show some debug output'
+complete -r -F -c init-checkconf -s f -l file -d 'Path to job configuration file to check'
+complete -r -F -c init-checkconf -s i -l initctl-path -d 'Path to initctl(8) binary'
+complete -f -c init-checkconf -s s -l noscript -d 'Do not check script sections'
+complete -r -F -c init-checkconf -s x -l startup-path -d 'Payh to startup(8) binary'
+complete -f -c init-checkconf -s h -l help -d 'Display usage statement'
diff --git a/srcpkgs/startup/files/initctl.fish b/srcpkgs/startup/files/initctl.fish
new file mode 100644
index 000000000000..0c5cc8a3445f
--- /dev/null
+++ b/srcpkgs/startup/files/initctl.fish
@@ -0,0 +1,125 @@
+# Global options
+complete -f -c initctl -l session -d 'Use existing session D-Bus session (for testing)'
+complete -f -c initctl -l system -d 'Use system D-Bus'
+complete -x -c initctl -l dest -d 'Name for the Startup daemon in system D-Bus'
+complete -f -c initctl -l user -d 'Run in user mode'
+complete -f -c initctl -s q -l quiet -d 'Only output errors'
+complete -f -c initctl -s v -l verbose -d 'Include informational messages'
+complete -f -c initctl -l help -d 'Show help'
+complete -f -c initctl -l version -d 'Output version information'
+
+# Job commands
+complete -f -c initctl -n __fish_use_subcommand -a start -d 'Start job'
+complete -f -c initctl -n __fish_use_subcommand -a stop -d 'Stop job'
+complete -f -c initctl -n __fish_use_subcommand -a restart -d 'Restart job'
+complete -f -c initctl -n __fish_use_subcommand -a reload -d 'Reload job'
+complete -f -c initctl -n __fish_use_subcommand -a status -d 'Query status of job'
+complete -f -c initctl -n __fish_use_subcommand -a list -d 'List known jobs'
+
+# Event commands
+complete -f -c initctl -n __fish_use_subcommand -a emit -d 'Emit an event'
+
+# Environment commands
+complete -f -c initctl -n __fish_use_subcommand -a get-env -d 'Retrieve value of a job environment variable'
+complete -f -c initctl -n __fish_use_subcommand -a list-env -d 'Show all job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a reset-env -d 'Revert all job environment variable changes'
+complete -f -c initctl -n __fish_use_subcommand -a set-env -d 'Set one or more job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a unset-env -d 'Remove one or more job environment variables'
+
+# Other commands
+complete -f -c initctl -n __fish_use_subcommand -a reload-configuration -d 'Reload init daemon configuration'
+complete -f -c initctl -n __fish_use_subcommand -a version -d 'Request version of the init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a log-priority -d 'Change minimum priority of log messages from init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a show-config -d 'Show emits, start on and stop on defaults for a job'
+complete -f -c initctl -n __fish_use_subcommand -a check-config -d 'Check for unreachable jobs/event conditions'
+complete -f -c initctl -n __fish_use_subcommand -a usage -d 'Show job usage message if available'
+complete -f -c initctl -n __fish_use_subcommand -a notify-cgroup-manager-address -d 'Inform Upstart of D-Bus address cgroup manager is available on'
+complete -f -c initctl -n __fish_use_subcommand -a notify-dbus-address -d 'Inform Upstart of D-Bus address to connect to'
+complete -f -c initctl -n __fish_use_subcommand -a notify-disk-writeable -d 'Inform Upstart that disk is now writeable'
+complete -f -c initctl -n __fish_use_subcommand -a list-sessions -d 'List all sessions'
+complete -f -c initctl -n __fish_use_subcommand -a re-exec -d 'Perform stateful re-exec'
+complete -f -c initctl -n __fish_use_subcommand -a help -d 'Display list of commands'
+
+# -n|--no-wait for some of the Job commands
+complete -f -c initctl -n "__fish_seen_subcommand_from start stop restart emit" -s n -l no-wait -d 'Do not wait for action to return'
+
+# -r|--retain for some of the Environment commands
+complete -f -c initctl -n "__fish_seen_subcommand_from set-env unset-env reset-env" -s r -l retain -d 'Do not modify already set variables'
+
+# Offer all 'stop/waiting' jobs with 'start' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from start" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+# Offer all 'start/*' jobs with 'stop', 'reload' and 'restart' subcommands
+complete -f -c initctl -n "__fish_seen_subcommand_from stop reload restart" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+# Offer all jobs with its status to the 'status' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from status" -a "(__fish_initctl_list_with_status)"
+
+# Offer all jobs to the 'check-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -a "(__fish_initctl_run list | string split ' ' -f 1)" -d Job
+
+# Offer all envs from 'list-env' subcommand to 'get-env' and 'unset-env'
+complete -f -c initctl -n "__fish_seen_subcommand_from get-env unset-env" -a "(__fish_initctl_run list-env | string replace -r '=' '\tVariable: ')"
+
+# Possible priority levels for 'log-priority' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from log-priority" -a "debug info message warn error fatal" -d 'Priority'
+
+# -e|--enumerate option for 'show-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from show-config" -s e -l enumerate -d 'Print per line each "start on" and "stop on" condition for each event or job'
+
+# -i|--ignore-events and -w|--warn for 'check-config' subcommand
+complete -x -c initctl -n "__fish_seen_subcommand_from check-config" -s i -l ignore-events -d 'Comma-separated list of events to ignore'
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -s w -l warn -d 'treat any unknown jobs and events as errors'
+
+# Show all the events from 'emits' in configuration to emit
+complete -x -c initctl -n "__fish_seen_subcommand_from emit" -a "(__fish_initctl_get_events)" -d 'Event'
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
+
+function __fish_initctl_extract_events -d 'Extract emitted events from job configuration'
+	grep -E '^[[:space:]]*emits ' $argv/*.conf \
+	| cut -d : -f 2- \
+	| string replace 'emit ' '' \
+	| string replace ' ' \n \
+	| sort -u
+end
+
+function __fish_initctl_get_events -d 'Print all events that jobs in the current context emit'
+	switch (__fish_initctl_context)
+		case system
+			set -l dirs /etc/startup /etc/init /usr/share/start /usr/share/xdg/startup
+			for d in (string replace : ' ' $XDG_CONFIG_DIRS)
+				set -l dirs $dirs $d/startup $d/upstart
+			end
+			__fish_initctl_extract_events $dirs
+		case user session
+			if set -q XDG_CONFIG_HOME
+				__fish_initctl_extract_events $XDG_CONFIG_HOME/startup $XDG_CONFIG_HOME/upstart
+			else
+				__fish_initctl_extract_events $HOME/.config/startup $HOME/.config/upstart
+			end
+	end
+end
diff --git a/srcpkgs/startup/files/startup-monitor.fish b/srcpkgs/startup/files/startup-monitor.fish
new file mode 100644
index 000000000000..70fa34ea29cb
--- /dev/null
+++ b/srcpkgs/startup/files/startup-monitor.fish
@@ -0,0 +1,5 @@
+# Global options
+complete -x -c startup-monitor -s d -l destination -d 'Which endpoint to connect to' -a "session-socket session-system system-socket system-bus"
+complete -f -c startup-monitor -s h -l help -d 'Show brief usage summary'
+complete -f -c startup-monitor -s n -l no-gui -d 'Run in command-line mode'
+complete -x -c startup-monitor -s s -l separator -d 'Specify alternate field separator for command-line output'
diff --git a/srcpkgs/startup/files/startup.fish b/srcpkgs/startup/files/startup.fish
new file mode 100644
index 000000000000..56b0313cc1b1
--- /dev/null
+++ b/srcpkgs/startup/files/startup.fish
@@ -0,0 +1,17 @@
+# Options
+complete -r -F -c startup -l append-confdir -d 'Append directories to look for job configuration files'
+complete -r -F -c startup -l confdir -d 'Read job configurationo files from this directory rather than defaults'
+complete -x -c startup -l default-console -d 'Default value for "console" stanza'
+complete -f -c startup -l no-cgroups -d 'Do not honour cgroup stanza'
+complete -f -c startup -l no-dbus -d 'Do connect to a D-Bus bus'
+complete -f -c startup -l no-inherint-env -d 'Stop jobs from inheriting initial environment'
+complete -r -F -c startup -l logdir -d 'Write job output log files to this directory'
+complete -f -c startup -l no-log -d 'Disable logging of job output'
+complete -f -c startup -l no-session -d 'Disable chroot sessions'
+complete -f -c startup -l no-startup-event -d 'Do not emit initial startup event'
+complete -r -F -c startup -l prepend-confdir -d 'Prepend directories to look for job configuration files'
+complete -f -c startup -l session -d 'Connect to the D-Bus session bus'
+complete -x -c startup -l startup-event -d 'emit a different event at startup than the default one'
+complete -f -c starutp -s q -l quiet -d 'Only output errors'
+complete -f -c startup -s v -l verbose -d 'Output verbose messages about job state changes and event emissions'
+complete -f -c startup -l version -d 'Output version information and exit'
diff --git a/srcpkgs/startup/template b/srcpkgs/startup/template
index eeeee53501a1..8f38967e26da 100644
--- a/srcpkgs/startup/template
+++ b/srcpkgs/startup/template
@@ -1,7 +1,7 @@
 # Template file for 'startup'
 pkgname=startup
 version=2.0.2
-revision=3
+revision=4
 build_style=gnu-configure
 configure_args="--disable-sysvcompat --disable-dconf-bridge --disable-cgroups"
 make_dirs="/var/log/startup 0750 root adm"
@@ -22,6 +22,12 @@ pre_configure() {
 
 post_install() {
 	rm -f -- "${DESTDIR}/usr/lib/libupstart.la"
+
+	# Fish completion
+	vinstall ${FILESDIR}/startup.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/init-checkconf.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/startup-monitor.fish 0644 /usr/share/fish/completions
 }
 
 startup-tools_package() {
@@ -33,6 +39,7 @@ startup-tools_package() {
 		vmove usr/share/icons
 		vmove usr/share/applications
 		vmove usr/share/man/man8/startup-monitor.8
+		vmove usr/share/fish/completions/startup-monitor.fish
 	}
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] startup: add completion for fish shell
  2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
  2021-09-06  7:35 ` [PR PATCH] [Updated] " maxice8
@ 2021-09-06 23:20 ` maxice8
  2021-09-14  3:43 ` maxice8
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: maxice8 @ 2021-09-06 23:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

There is an updated pull request by maxice8 against master on the void-packages repository

https://github.com/maxice8/void-packages startup
https://github.com/void-linux/void-packages/pull/32854

startup: add completion for fish shell
upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41


A patch file from https://github.com/void-linux/void-packages/pull/32854.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-startup-32854.patch --]
[-- Type: text/x-diff, Size: 13744 bytes --]

From c03b9a17ad6428715a4ae6c2feef5038749a6a49 Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Mon, 6 Sep 2021 07:14:57 +0000
Subject: [PATCH] startup: add completion for fish shell

upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41
---
 srcpkgs/startup/files/init-checkconf.fish  |   7 ++
 srcpkgs/startup/files/initctl.fish         | 125 +++++++++++++++++++++
 srcpkgs/startup/files/initctl2dot.fish     |  16 +++
 srcpkgs/startup/files/startup-monitor.fish |   5 +
 srcpkgs/startup/files/startup.fish         |  17 +++
 srcpkgs/startup/template                   |  11 +-
 6 files changed, 180 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/startup/files/init-checkconf.fish
 create mode 100644 srcpkgs/startup/files/initctl.fish
 create mode 100644 srcpkgs/startup/files/initctl2dot.fish
 create mode 100644 srcpkgs/startup/files/startup-monitor.fish
 create mode 100644 srcpkgs/startup/files/startup.fish

diff --git a/srcpkgs/startup/files/init-checkconf.fish b/srcpkgs/startup/files/init-checkconf.fish
new file mode 100644
index 000000000000..d14b4b4b7054
--- /dev/null
+++ b/srcpkgs/startup/files/init-checkconf.fish
@@ -0,0 +1,7 @@
+# Global options
+complete -f -c init-checkconf -s d -l debug -d 'Show some debug output'
+complete -r -F -c init-checkconf -s f -l file -d 'Path to job configuration file to check'
+complete -r -F -c init-checkconf -s i -l initctl-path -d 'Path to initctl(8) binary'
+complete -f -c init-checkconf -s s -l noscript -d 'Do not check script sections'
+complete -r -F -c init-checkconf -s x -l startup-path -d 'Payh to startup(8) binary'
+complete -f -c init-checkconf -s h -l help -d 'Display usage statement'
diff --git a/srcpkgs/startup/files/initctl.fish b/srcpkgs/startup/files/initctl.fish
new file mode 100644
index 000000000000..0c5cc8a3445f
--- /dev/null
+++ b/srcpkgs/startup/files/initctl.fish
@@ -0,0 +1,125 @@
+# Global options
+complete -f -c initctl -l session -d 'Use existing session D-Bus session (for testing)'
+complete -f -c initctl -l system -d 'Use system D-Bus'
+complete -x -c initctl -l dest -d 'Name for the Startup daemon in system D-Bus'
+complete -f -c initctl -l user -d 'Run in user mode'
+complete -f -c initctl -s q -l quiet -d 'Only output errors'
+complete -f -c initctl -s v -l verbose -d 'Include informational messages'
+complete -f -c initctl -l help -d 'Show help'
+complete -f -c initctl -l version -d 'Output version information'
+
+# Job commands
+complete -f -c initctl -n __fish_use_subcommand -a start -d 'Start job'
+complete -f -c initctl -n __fish_use_subcommand -a stop -d 'Stop job'
+complete -f -c initctl -n __fish_use_subcommand -a restart -d 'Restart job'
+complete -f -c initctl -n __fish_use_subcommand -a reload -d 'Reload job'
+complete -f -c initctl -n __fish_use_subcommand -a status -d 'Query status of job'
+complete -f -c initctl -n __fish_use_subcommand -a list -d 'List known jobs'
+
+# Event commands
+complete -f -c initctl -n __fish_use_subcommand -a emit -d 'Emit an event'
+
+# Environment commands
+complete -f -c initctl -n __fish_use_subcommand -a get-env -d 'Retrieve value of a job environment variable'
+complete -f -c initctl -n __fish_use_subcommand -a list-env -d 'Show all job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a reset-env -d 'Revert all job environment variable changes'
+complete -f -c initctl -n __fish_use_subcommand -a set-env -d 'Set one or more job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a unset-env -d 'Remove one or more job environment variables'
+
+# Other commands
+complete -f -c initctl -n __fish_use_subcommand -a reload-configuration -d 'Reload init daemon configuration'
+complete -f -c initctl -n __fish_use_subcommand -a version -d 'Request version of the init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a log-priority -d 'Change minimum priority of log messages from init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a show-config -d 'Show emits, start on and stop on defaults for a job'
+complete -f -c initctl -n __fish_use_subcommand -a check-config -d 'Check for unreachable jobs/event conditions'
+complete -f -c initctl -n __fish_use_subcommand -a usage -d 'Show job usage message if available'
+complete -f -c initctl -n __fish_use_subcommand -a notify-cgroup-manager-address -d 'Inform Upstart of D-Bus address cgroup manager is available on'
+complete -f -c initctl -n __fish_use_subcommand -a notify-dbus-address -d 'Inform Upstart of D-Bus address to connect to'
+complete -f -c initctl -n __fish_use_subcommand -a notify-disk-writeable -d 'Inform Upstart that disk is now writeable'
+complete -f -c initctl -n __fish_use_subcommand -a list-sessions -d 'List all sessions'
+complete -f -c initctl -n __fish_use_subcommand -a re-exec -d 'Perform stateful re-exec'
+complete -f -c initctl -n __fish_use_subcommand -a help -d 'Display list of commands'
+
+# -n|--no-wait for some of the Job commands
+complete -f -c initctl -n "__fish_seen_subcommand_from start stop restart emit" -s n -l no-wait -d 'Do not wait for action to return'
+
+# -r|--retain for some of the Environment commands
+complete -f -c initctl -n "__fish_seen_subcommand_from set-env unset-env reset-env" -s r -l retain -d 'Do not modify already set variables'
+
+# Offer all 'stop/waiting' jobs with 'start' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from start" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+# Offer all 'start/*' jobs with 'stop', 'reload' and 'restart' subcommands
+complete -f -c initctl -n "__fish_seen_subcommand_from stop reload restart" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+# Offer all jobs with its status to the 'status' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from status" -a "(__fish_initctl_list_with_status)"
+
+# Offer all jobs to the 'check-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -a "(__fish_initctl_run list | string split ' ' -f 1)" -d Job
+
+# Offer all envs from 'list-env' subcommand to 'get-env' and 'unset-env'
+complete -f -c initctl -n "__fish_seen_subcommand_from get-env unset-env" -a "(__fish_initctl_run list-env | string replace -r '=' '\tVariable: ')"
+
+# Possible priority levels for 'log-priority' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from log-priority" -a "debug info message warn error fatal" -d 'Priority'
+
+# -e|--enumerate option for 'show-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from show-config" -s e -l enumerate -d 'Print per line each "start on" and "stop on" condition for each event or job'
+
+# -i|--ignore-events and -w|--warn for 'check-config' subcommand
+complete -x -c initctl -n "__fish_seen_subcommand_from check-config" -s i -l ignore-events -d 'Comma-separated list of events to ignore'
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -s w -l warn -d 'treat any unknown jobs and events as errors'
+
+# Show all the events from 'emits' in configuration to emit
+complete -x -c initctl -n "__fish_seen_subcommand_from emit" -a "(__fish_initctl_get_events)" -d 'Event'
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
+
+function __fish_initctl_extract_events -d 'Extract emitted events from job configuration'
+	grep -E '^[[:space:]]*emits ' $argv/*.conf \
+	| cut -d : -f 2- \
+	| string replace 'emit ' '' \
+	| string replace ' ' \n \
+	| sort -u
+end
+
+function __fish_initctl_get_events -d 'Print all events that jobs in the current context emit'
+	switch (__fish_initctl_context)
+		case system
+			set -l dirs /etc/startup /etc/init /usr/share/start /usr/share/xdg/startup
+			for d in (string replace : ' ' $XDG_CONFIG_DIRS)
+				set -l dirs $dirs $d/startup $d/upstart
+			end
+			__fish_initctl_extract_events $dirs
+		case user session
+			if set -q XDG_CONFIG_HOME
+				__fish_initctl_extract_events $XDG_CONFIG_HOME/startup $XDG_CONFIG_HOME/upstart
+			else
+				__fish_initctl_extract_events $HOME/.config/startup $HOME/.config/upstart
+			end
+	end
+end
diff --git a/srcpkgs/startup/files/initctl2dot.fish b/srcpkgs/startup/files/initctl2dot.fish
new file mode 100644
index 000000000000..868bd9b5dbf8
--- /dev/null
+++ b/srcpkgs/startup/files/initctl2dot.fish
@@ -0,0 +1,16 @@
+# global options
+complete -x -c initctl2dot -s f -l infile -d 'File to read initctl(8) output from instead of (initctl show-config -e)'
+complete -f -c initctl2dot -s h -l help -d 'Display usage statement'
+complete -x -c initctl2dot -s r -l restrict-to-jobs -d 'Comma-separated list of jobs to consider instead of all jobs'
+complete -x -c initctl2dot -s w -l outfile -d 'File to write output to'
+complete -x -c initctl2dot -l color-emits -d 'Color for "emits" lines'
+complete -x -c initctl2dot -l color-start-on -d 'Color for "start on" lines'
+complete -x -c initctl2dot -l color-stop-on -d 'Color for "stop on" lines'
+complete -x -c initctl2dot -l color-event -d 'Color for event boxes'
+complete -x -c initctl2dot -l color-text -d 'Color for text in summary'
+complete -x -c initctl2dot -l color-bg -d 'Color for background of the diagram'
+complete -x -c initctl2dot -l color-event-text -d 'Color for text for event boxes'
+complete -x -c initctl2dot -l color-job-text -d 'Color for text in job boxes'
+complete -x -c initctl2dot -l color-job -d 'Color for job boxes'
+complete -f -c initctl2dot -l system -d 'Connect to the system session'
+complete -f -c initctl2dot -l user -d 'Connect to the user session'
diff --git a/srcpkgs/startup/files/startup-monitor.fish b/srcpkgs/startup/files/startup-monitor.fish
new file mode 100644
index 000000000000..70fa34ea29cb
--- /dev/null
+++ b/srcpkgs/startup/files/startup-monitor.fish
@@ -0,0 +1,5 @@
+# Global options
+complete -x -c startup-monitor -s d -l destination -d 'Which endpoint to connect to' -a "session-socket session-system system-socket system-bus"
+complete -f -c startup-monitor -s h -l help -d 'Show brief usage summary'
+complete -f -c startup-monitor -s n -l no-gui -d 'Run in command-line mode'
+complete -x -c startup-monitor -s s -l separator -d 'Specify alternate field separator for command-line output'
diff --git a/srcpkgs/startup/files/startup.fish b/srcpkgs/startup/files/startup.fish
new file mode 100644
index 000000000000..56b0313cc1b1
--- /dev/null
+++ b/srcpkgs/startup/files/startup.fish
@@ -0,0 +1,17 @@
+# Options
+complete -r -F -c startup -l append-confdir -d 'Append directories to look for job configuration files'
+complete -r -F -c startup -l confdir -d 'Read job configurationo files from this directory rather than defaults'
+complete -x -c startup -l default-console -d 'Default value for "console" stanza'
+complete -f -c startup -l no-cgroups -d 'Do not honour cgroup stanza'
+complete -f -c startup -l no-dbus -d 'Do connect to a D-Bus bus'
+complete -f -c startup -l no-inherint-env -d 'Stop jobs from inheriting initial environment'
+complete -r -F -c startup -l logdir -d 'Write job output log files to this directory'
+complete -f -c startup -l no-log -d 'Disable logging of job output'
+complete -f -c startup -l no-session -d 'Disable chroot sessions'
+complete -f -c startup -l no-startup-event -d 'Do not emit initial startup event'
+complete -r -F -c startup -l prepend-confdir -d 'Prepend directories to look for job configuration files'
+complete -f -c startup -l session -d 'Connect to the D-Bus session bus'
+complete -x -c startup -l startup-event -d 'emit a different event at startup than the default one'
+complete -f -c starutp -s q -l quiet -d 'Only output errors'
+complete -f -c startup -s v -l verbose -d 'Output verbose messages about job state changes and event emissions'
+complete -f -c startup -l version -d 'Output version information and exit'
diff --git a/srcpkgs/startup/template b/srcpkgs/startup/template
index eeeee53501a1..d7707f61b72a 100644
--- a/srcpkgs/startup/template
+++ b/srcpkgs/startup/template
@@ -1,7 +1,7 @@
 # Template file for 'startup'
 pkgname=startup
 version=2.0.2
-revision=3
+revision=4
 build_style=gnu-configure
 configure_args="--disable-sysvcompat --disable-dconf-bridge --disable-cgroups"
 make_dirs="/var/log/startup 0750 root adm"
@@ -22,6 +22,13 @@ pre_configure() {
 
 post_install() {
 	rm -f -- "${DESTDIR}/usr/lib/libupstart.la"
+
+	# Fish completion
+	vinstall ${FILESDIR}/startup.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/startup-monitor.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl2dot.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/init-checkconf.fish 0644 /usr/share/fish/completions
 }
 
 startup-tools_package() {
@@ -33,6 +40,8 @@ startup-tools_package() {
 		vmove usr/share/icons
 		vmove usr/share/applications
 		vmove usr/share/man/man8/startup-monitor.8
+		vmove usr/share/fish/completions/startup-monitor.fish
+		vmove usr/share/fish/completions/initctl2dot.fish
 	}
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] startup: add completion for fish shell
  2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
  2021-09-06  7:35 ` [PR PATCH] [Updated] " maxice8
  2021-09-06 23:20 ` maxice8
@ 2021-09-14  3:43 ` maxice8
  2021-09-14  3:50 ` maxice8
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: maxice8 @ 2021-09-14  3:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

There is an updated pull request by maxice8 against master on the void-packages repository

https://github.com/maxice8/void-packages startup
https://github.com/void-linux/void-packages/pull/32854

startup: add completion for fish shell
upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41


A patch file from https://github.com/void-linux/void-packages/pull/32854.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-startup-32854.patch --]
[-- Type: text/x-diff, Size: 32115 bytes --]

From 0cfbb7139ab07e12987d98062fa98b7de214f860 Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Mon, 6 Sep 2021 07:14:57 +0000
Subject: [PATCH] startup: add completion for fish shell

upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41
---
 srcpkgs/startup/files/init-checkconf.fish  |   7 ++
 srcpkgs/startup/files/initctl.fish         | 125 +++++++++++++++++++++
 srcpkgs/startup/files/initctl2dot.fish     |  16 +++
 srcpkgs/startup/files/startup-monitor.fish |   5 +
 srcpkgs/startup/files/startup.fish         |  17 +++
 srcpkgs/startup/init-checkconf.fish        |   7 ++
 srcpkgs/startup/initctl.fish               | 125 +++++++++++++++++++++
 srcpkgs/startup/initctl2dot.fish           |  16 +++
 srcpkgs/startup/reload.fish                |  29 +++++
 srcpkgs/startup/restart.fish               |  29 +++++
 srcpkgs/startup/start.fish                 |  29 +++++
 srcpkgs/startup/startup-monitor.fish       |   5 +
 srcpkgs/startup/startup.fish               |  17 +++
 srcpkgs/startup/status.fish                |  36 ++++++
 srcpkgs/startup/stop.fish                  |  29 +++++
 srcpkgs/startup/template                   |  16 ++-
 16 files changed, 507 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/startup/files/init-checkconf.fish
 create mode 100644 srcpkgs/startup/files/initctl.fish
 create mode 100644 srcpkgs/startup/files/initctl2dot.fish
 create mode 100644 srcpkgs/startup/files/startup-monitor.fish
 create mode 100644 srcpkgs/startup/files/startup.fish
 create mode 100644 srcpkgs/startup/init-checkconf.fish
 create mode 100644 srcpkgs/startup/initctl.fish
 create mode 100644 srcpkgs/startup/initctl2dot.fish
 create mode 100644 srcpkgs/startup/reload.fish
 create mode 100644 srcpkgs/startup/restart.fish
 create mode 100644 srcpkgs/startup/start.fish
 create mode 100644 srcpkgs/startup/startup-monitor.fish
 create mode 100644 srcpkgs/startup/startup.fish
 create mode 100644 srcpkgs/startup/status.fish
 create mode 100644 srcpkgs/startup/stop.fish

diff --git a/srcpkgs/startup/files/init-checkconf.fish b/srcpkgs/startup/files/init-checkconf.fish
new file mode 100644
index 000000000000..d14b4b4b7054
--- /dev/null
+++ b/srcpkgs/startup/files/init-checkconf.fish
@@ -0,0 +1,7 @@
+# Global options
+complete -f -c init-checkconf -s d -l debug -d 'Show some debug output'
+complete -r -F -c init-checkconf -s f -l file -d 'Path to job configuration file to check'
+complete -r -F -c init-checkconf -s i -l initctl-path -d 'Path to initctl(8) binary'
+complete -f -c init-checkconf -s s -l noscript -d 'Do not check script sections'
+complete -r -F -c init-checkconf -s x -l startup-path -d 'Payh to startup(8) binary'
+complete -f -c init-checkconf -s h -l help -d 'Display usage statement'
diff --git a/srcpkgs/startup/files/initctl.fish b/srcpkgs/startup/files/initctl.fish
new file mode 100644
index 000000000000..0c5cc8a3445f
--- /dev/null
+++ b/srcpkgs/startup/files/initctl.fish
@@ -0,0 +1,125 @@
+# Global options
+complete -f -c initctl -l session -d 'Use existing session D-Bus session (for testing)'
+complete -f -c initctl -l system -d 'Use system D-Bus'
+complete -x -c initctl -l dest -d 'Name for the Startup daemon in system D-Bus'
+complete -f -c initctl -l user -d 'Run in user mode'
+complete -f -c initctl -s q -l quiet -d 'Only output errors'
+complete -f -c initctl -s v -l verbose -d 'Include informational messages'
+complete -f -c initctl -l help -d 'Show help'
+complete -f -c initctl -l version -d 'Output version information'
+
+# Job commands
+complete -f -c initctl -n __fish_use_subcommand -a start -d 'Start job'
+complete -f -c initctl -n __fish_use_subcommand -a stop -d 'Stop job'
+complete -f -c initctl -n __fish_use_subcommand -a restart -d 'Restart job'
+complete -f -c initctl -n __fish_use_subcommand -a reload -d 'Reload job'
+complete -f -c initctl -n __fish_use_subcommand -a status -d 'Query status of job'
+complete -f -c initctl -n __fish_use_subcommand -a list -d 'List known jobs'
+
+# Event commands
+complete -f -c initctl -n __fish_use_subcommand -a emit -d 'Emit an event'
+
+# Environment commands
+complete -f -c initctl -n __fish_use_subcommand -a get-env -d 'Retrieve value of a job environment variable'
+complete -f -c initctl -n __fish_use_subcommand -a list-env -d 'Show all job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a reset-env -d 'Revert all job environment variable changes'
+complete -f -c initctl -n __fish_use_subcommand -a set-env -d 'Set one or more job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a unset-env -d 'Remove one or more job environment variables'
+
+# Other commands
+complete -f -c initctl -n __fish_use_subcommand -a reload-configuration -d 'Reload init daemon configuration'
+complete -f -c initctl -n __fish_use_subcommand -a version -d 'Request version of the init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a log-priority -d 'Change minimum priority of log messages from init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a show-config -d 'Show emits, start on and stop on defaults for a job'
+complete -f -c initctl -n __fish_use_subcommand -a check-config -d 'Check for unreachable jobs/event conditions'
+complete -f -c initctl -n __fish_use_subcommand -a usage -d 'Show job usage message if available'
+complete -f -c initctl -n __fish_use_subcommand -a notify-cgroup-manager-address -d 'Inform Upstart of D-Bus address cgroup manager is available on'
+complete -f -c initctl -n __fish_use_subcommand -a notify-dbus-address -d 'Inform Upstart of D-Bus address to connect to'
+complete -f -c initctl -n __fish_use_subcommand -a notify-disk-writeable -d 'Inform Upstart that disk is now writeable'
+complete -f -c initctl -n __fish_use_subcommand -a list-sessions -d 'List all sessions'
+complete -f -c initctl -n __fish_use_subcommand -a re-exec -d 'Perform stateful re-exec'
+complete -f -c initctl -n __fish_use_subcommand -a help -d 'Display list of commands'
+
+# -n|--no-wait for some of the Job commands
+complete -f -c initctl -n "__fish_seen_subcommand_from start stop restart emit" -s n -l no-wait -d 'Do not wait for action to return'
+
+# -r|--retain for some of the Environment commands
+complete -f -c initctl -n "__fish_seen_subcommand_from set-env unset-env reset-env" -s r -l retain -d 'Do not modify already set variables'
+
+# Offer all 'stop/waiting' jobs with 'start' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from start" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+# Offer all 'start/*' jobs with 'stop', 'reload' and 'restart' subcommands
+complete -f -c initctl -n "__fish_seen_subcommand_from stop reload restart" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+# Offer all jobs with its status to the 'status' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from status" -a "(__fish_initctl_list_with_status)"
+
+# Offer all jobs to the 'check-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -a "(__fish_initctl_run list | string split ' ' -f 1)" -d Job
+
+# Offer all envs from 'list-env' subcommand to 'get-env' and 'unset-env'
+complete -f -c initctl -n "__fish_seen_subcommand_from get-env unset-env" -a "(__fish_initctl_run list-env | string replace -r '=' '\tVariable: ')"
+
+# Possible priority levels for 'log-priority' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from log-priority" -a "debug info message warn error fatal" -d 'Priority'
+
+# -e|--enumerate option for 'show-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from show-config" -s e -l enumerate -d 'Print per line each "start on" and "stop on" condition for each event or job'
+
+# -i|--ignore-events and -w|--warn for 'check-config' subcommand
+complete -x -c initctl -n "__fish_seen_subcommand_from check-config" -s i -l ignore-events -d 'Comma-separated list of events to ignore'
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -s w -l warn -d 'treat any unknown jobs and events as errors'
+
+# Show all the events from 'emits' in configuration to emit
+complete -x -c initctl -n "__fish_seen_subcommand_from emit" -a "(__fish_initctl_get_events)" -d 'Event'
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
+
+function __fish_initctl_extract_events -d 'Extract emitted events from job configuration'
+	grep -E '^[[:space:]]*emits ' $argv/*.conf \
+	| cut -d : -f 2- \
+	| string replace 'emit ' '' \
+	| string replace ' ' \n \
+	| sort -u
+end
+
+function __fish_initctl_get_events -d 'Print all events that jobs in the current context emit'
+	switch (__fish_initctl_context)
+		case system
+			set -l dirs /etc/startup /etc/init /usr/share/start /usr/share/xdg/startup
+			for d in (string replace : ' ' $XDG_CONFIG_DIRS)
+				set -l dirs $dirs $d/startup $d/upstart
+			end
+			__fish_initctl_extract_events $dirs
+		case user session
+			if set -q XDG_CONFIG_HOME
+				__fish_initctl_extract_events $XDG_CONFIG_HOME/startup $XDG_CONFIG_HOME/upstart
+			else
+				__fish_initctl_extract_events $HOME/.config/startup $HOME/.config/upstart
+			end
+	end
+end
diff --git a/srcpkgs/startup/files/initctl2dot.fish b/srcpkgs/startup/files/initctl2dot.fish
new file mode 100644
index 000000000000..868bd9b5dbf8
--- /dev/null
+++ b/srcpkgs/startup/files/initctl2dot.fish
@@ -0,0 +1,16 @@
+# global options
+complete -x -c initctl2dot -s f -l infile -d 'File to read initctl(8) output from instead of (initctl show-config -e)'
+complete -f -c initctl2dot -s h -l help -d 'Display usage statement'
+complete -x -c initctl2dot -s r -l restrict-to-jobs -d 'Comma-separated list of jobs to consider instead of all jobs'
+complete -x -c initctl2dot -s w -l outfile -d 'File to write output to'
+complete -x -c initctl2dot -l color-emits -d 'Color for "emits" lines'
+complete -x -c initctl2dot -l color-start-on -d 'Color for "start on" lines'
+complete -x -c initctl2dot -l color-stop-on -d 'Color for "stop on" lines'
+complete -x -c initctl2dot -l color-event -d 'Color for event boxes'
+complete -x -c initctl2dot -l color-text -d 'Color for text in summary'
+complete -x -c initctl2dot -l color-bg -d 'Color for background of the diagram'
+complete -x -c initctl2dot -l color-event-text -d 'Color for text for event boxes'
+complete -x -c initctl2dot -l color-job-text -d 'Color for text in job boxes'
+complete -x -c initctl2dot -l color-job -d 'Color for job boxes'
+complete -f -c initctl2dot -l system -d 'Connect to the system session'
+complete -f -c initctl2dot -l user -d 'Connect to the user session'
diff --git a/srcpkgs/startup/files/startup-monitor.fish b/srcpkgs/startup/files/startup-monitor.fish
new file mode 100644
index 000000000000..70fa34ea29cb
--- /dev/null
+++ b/srcpkgs/startup/files/startup-monitor.fish
@@ -0,0 +1,5 @@
+# Global options
+complete -x -c startup-monitor -s d -l destination -d 'Which endpoint to connect to' -a "session-socket session-system system-socket system-bus"
+complete -f -c startup-monitor -s h -l help -d 'Show brief usage summary'
+complete -f -c startup-monitor -s n -l no-gui -d 'Run in command-line mode'
+complete -x -c startup-monitor -s s -l separator -d 'Specify alternate field separator for command-line output'
diff --git a/srcpkgs/startup/files/startup.fish b/srcpkgs/startup/files/startup.fish
new file mode 100644
index 000000000000..56b0313cc1b1
--- /dev/null
+++ b/srcpkgs/startup/files/startup.fish
@@ -0,0 +1,17 @@
+# Options
+complete -r -F -c startup -l append-confdir -d 'Append directories to look for job configuration files'
+complete -r -F -c startup -l confdir -d 'Read job configurationo files from this directory rather than defaults'
+complete -x -c startup -l default-console -d 'Default value for "console" stanza'
+complete -f -c startup -l no-cgroups -d 'Do not honour cgroup stanza'
+complete -f -c startup -l no-dbus -d 'Do connect to a D-Bus bus'
+complete -f -c startup -l no-inherint-env -d 'Stop jobs from inheriting initial environment'
+complete -r -F -c startup -l logdir -d 'Write job output log files to this directory'
+complete -f -c startup -l no-log -d 'Disable logging of job output'
+complete -f -c startup -l no-session -d 'Disable chroot sessions'
+complete -f -c startup -l no-startup-event -d 'Do not emit initial startup event'
+complete -r -F -c startup -l prepend-confdir -d 'Prepend directories to look for job configuration files'
+complete -f -c startup -l session -d 'Connect to the D-Bus session bus'
+complete -x -c startup -l startup-event -d 'emit a different event at startup than the default one'
+complete -f -c starutp -s q -l quiet -d 'Only output errors'
+complete -f -c startup -s v -l verbose -d 'Output verbose messages about job state changes and event emissions'
+complete -f -c startup -l version -d 'Output version information and exit'
diff --git a/srcpkgs/startup/init-checkconf.fish b/srcpkgs/startup/init-checkconf.fish
new file mode 100644
index 000000000000..d14b4b4b7054
--- /dev/null
+++ b/srcpkgs/startup/init-checkconf.fish
@@ -0,0 +1,7 @@
+# Global options
+complete -f -c init-checkconf -s d -l debug -d 'Show some debug output'
+complete -r -F -c init-checkconf -s f -l file -d 'Path to job configuration file to check'
+complete -r -F -c init-checkconf -s i -l initctl-path -d 'Path to initctl(8) binary'
+complete -f -c init-checkconf -s s -l noscript -d 'Do not check script sections'
+complete -r -F -c init-checkconf -s x -l startup-path -d 'Payh to startup(8) binary'
+complete -f -c init-checkconf -s h -l help -d 'Display usage statement'
diff --git a/srcpkgs/startup/initctl.fish b/srcpkgs/startup/initctl.fish
new file mode 100644
index 000000000000..0c5cc8a3445f
--- /dev/null
+++ b/srcpkgs/startup/initctl.fish
@@ -0,0 +1,125 @@
+# Global options
+complete -f -c initctl -l session -d 'Use existing session D-Bus session (for testing)'
+complete -f -c initctl -l system -d 'Use system D-Bus'
+complete -x -c initctl -l dest -d 'Name for the Startup daemon in system D-Bus'
+complete -f -c initctl -l user -d 'Run in user mode'
+complete -f -c initctl -s q -l quiet -d 'Only output errors'
+complete -f -c initctl -s v -l verbose -d 'Include informational messages'
+complete -f -c initctl -l help -d 'Show help'
+complete -f -c initctl -l version -d 'Output version information'
+
+# Job commands
+complete -f -c initctl -n __fish_use_subcommand -a start -d 'Start job'
+complete -f -c initctl -n __fish_use_subcommand -a stop -d 'Stop job'
+complete -f -c initctl -n __fish_use_subcommand -a restart -d 'Restart job'
+complete -f -c initctl -n __fish_use_subcommand -a reload -d 'Reload job'
+complete -f -c initctl -n __fish_use_subcommand -a status -d 'Query status of job'
+complete -f -c initctl -n __fish_use_subcommand -a list -d 'List known jobs'
+
+# Event commands
+complete -f -c initctl -n __fish_use_subcommand -a emit -d 'Emit an event'
+
+# Environment commands
+complete -f -c initctl -n __fish_use_subcommand -a get-env -d 'Retrieve value of a job environment variable'
+complete -f -c initctl -n __fish_use_subcommand -a list-env -d 'Show all job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a reset-env -d 'Revert all job environment variable changes'
+complete -f -c initctl -n __fish_use_subcommand -a set-env -d 'Set one or more job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a unset-env -d 'Remove one or more job environment variables'
+
+# Other commands
+complete -f -c initctl -n __fish_use_subcommand -a reload-configuration -d 'Reload init daemon configuration'
+complete -f -c initctl -n __fish_use_subcommand -a version -d 'Request version of the init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a log-priority -d 'Change minimum priority of log messages from init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a show-config -d 'Show emits, start on and stop on defaults for a job'
+complete -f -c initctl -n __fish_use_subcommand -a check-config -d 'Check for unreachable jobs/event conditions'
+complete -f -c initctl -n __fish_use_subcommand -a usage -d 'Show job usage message if available'
+complete -f -c initctl -n __fish_use_subcommand -a notify-cgroup-manager-address -d 'Inform Upstart of D-Bus address cgroup manager is available on'
+complete -f -c initctl -n __fish_use_subcommand -a notify-dbus-address -d 'Inform Upstart of D-Bus address to connect to'
+complete -f -c initctl -n __fish_use_subcommand -a notify-disk-writeable -d 'Inform Upstart that disk is now writeable'
+complete -f -c initctl -n __fish_use_subcommand -a list-sessions -d 'List all sessions'
+complete -f -c initctl -n __fish_use_subcommand -a re-exec -d 'Perform stateful re-exec'
+complete -f -c initctl -n __fish_use_subcommand -a help -d 'Display list of commands'
+
+# -n|--no-wait for some of the Job commands
+complete -f -c initctl -n "__fish_seen_subcommand_from start stop restart emit" -s n -l no-wait -d 'Do not wait for action to return'
+
+# -r|--retain for some of the Environment commands
+complete -f -c initctl -n "__fish_seen_subcommand_from set-env unset-env reset-env" -s r -l retain -d 'Do not modify already set variables'
+
+# Offer all 'stop/waiting' jobs with 'start' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from start" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+# Offer all 'start/*' jobs with 'stop', 'reload' and 'restart' subcommands
+complete -f -c initctl -n "__fish_seen_subcommand_from stop reload restart" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+# Offer all jobs with its status to the 'status' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from status" -a "(__fish_initctl_list_with_status)"
+
+# Offer all jobs to the 'check-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -a "(__fish_initctl_run list | string split ' ' -f 1)" -d Job
+
+# Offer all envs from 'list-env' subcommand to 'get-env' and 'unset-env'
+complete -f -c initctl -n "__fish_seen_subcommand_from get-env unset-env" -a "(__fish_initctl_run list-env | string replace -r '=' '\tVariable: ')"
+
+# Possible priority levels for 'log-priority' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from log-priority" -a "debug info message warn error fatal" -d 'Priority'
+
+# -e|--enumerate option for 'show-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from show-config" -s e -l enumerate -d 'Print per line each "start on" and "stop on" condition for each event or job'
+
+# -i|--ignore-events and -w|--warn for 'check-config' subcommand
+complete -x -c initctl -n "__fish_seen_subcommand_from check-config" -s i -l ignore-events -d 'Comma-separated list of events to ignore'
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -s w -l warn -d 'treat any unknown jobs and events as errors'
+
+# Show all the events from 'emits' in configuration to emit
+complete -x -c initctl -n "__fish_seen_subcommand_from emit" -a "(__fish_initctl_get_events)" -d 'Event'
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
+
+function __fish_initctl_extract_events -d 'Extract emitted events from job configuration'
+	grep -E '^[[:space:]]*emits ' $argv/*.conf \
+	| cut -d : -f 2- \
+	| string replace 'emit ' '' \
+	| string replace ' ' \n \
+	| sort -u
+end
+
+function __fish_initctl_get_events -d 'Print all events that jobs in the current context emit'
+	switch (__fish_initctl_context)
+		case system
+			set -l dirs /etc/startup /etc/init /usr/share/start /usr/share/xdg/startup
+			for d in (string replace : ' ' $XDG_CONFIG_DIRS)
+				set -l dirs $dirs $d/startup $d/upstart
+			end
+			__fish_initctl_extract_events $dirs
+		case user session
+			if set -q XDG_CONFIG_HOME
+				__fish_initctl_extract_events $XDG_CONFIG_HOME/startup $XDG_CONFIG_HOME/upstart
+			else
+				__fish_initctl_extract_events $HOME/.config/startup $HOME/.config/upstart
+			end
+	end
+end
diff --git a/srcpkgs/startup/initctl2dot.fish b/srcpkgs/startup/initctl2dot.fish
new file mode 100644
index 000000000000..868bd9b5dbf8
--- /dev/null
+++ b/srcpkgs/startup/initctl2dot.fish
@@ -0,0 +1,16 @@
+# global options
+complete -x -c initctl2dot -s f -l infile -d 'File to read initctl(8) output from instead of (initctl show-config -e)'
+complete -f -c initctl2dot -s h -l help -d 'Display usage statement'
+complete -x -c initctl2dot -s r -l restrict-to-jobs -d 'Comma-separated list of jobs to consider instead of all jobs'
+complete -x -c initctl2dot -s w -l outfile -d 'File to write output to'
+complete -x -c initctl2dot -l color-emits -d 'Color for "emits" lines'
+complete -x -c initctl2dot -l color-start-on -d 'Color for "start on" lines'
+complete -x -c initctl2dot -l color-stop-on -d 'Color for "stop on" lines'
+complete -x -c initctl2dot -l color-event -d 'Color for event boxes'
+complete -x -c initctl2dot -l color-text -d 'Color for text in summary'
+complete -x -c initctl2dot -l color-bg -d 'Color for background of the diagram'
+complete -x -c initctl2dot -l color-event-text -d 'Color for text for event boxes'
+complete -x -c initctl2dot -l color-job-text -d 'Color for text in job boxes'
+complete -x -c initctl2dot -l color-job -d 'Color for job boxes'
+complete -f -c initctl2dot -l system -d 'Connect to the system session'
+complete -f -c initctl2dot -l user -d 'Connect to the user session'
diff --git a/srcpkgs/startup/reload.fish b/srcpkgs/startup/reload.fish
new file mode 100644
index 000000000000..8fd9d500a739
--- /dev/null
+++ b/srcpkgs/startup/reload.fish
@@ -0,0 +1,29 @@
+complete -f -c reload -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/restart.fish b/srcpkgs/startup/restart.fish
new file mode 100644
index 000000000000..8b246534920a
--- /dev/null
+++ b/srcpkgs/startup/restart.fish
@@ -0,0 +1,29 @@
+complete -f -c restart -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/start.fish b/srcpkgs/startup/start.fish
new file mode 100644
index 000000000000..514a6db251f2
--- /dev/null
+++ b/srcpkgs/startup/start.fish
@@ -0,0 +1,29 @@
+complete -f -c start -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/startup-monitor.fish b/srcpkgs/startup/startup-monitor.fish
new file mode 100644
index 000000000000..70fa34ea29cb
--- /dev/null
+++ b/srcpkgs/startup/startup-monitor.fish
@@ -0,0 +1,5 @@
+# Global options
+complete -x -c startup-monitor -s d -l destination -d 'Which endpoint to connect to' -a "session-socket session-system system-socket system-bus"
+complete -f -c startup-monitor -s h -l help -d 'Show brief usage summary'
+complete -f -c startup-monitor -s n -l no-gui -d 'Run in command-line mode'
+complete -x -c startup-monitor -s s -l separator -d 'Specify alternate field separator for command-line output'
diff --git a/srcpkgs/startup/startup.fish b/srcpkgs/startup/startup.fish
new file mode 100644
index 000000000000..56b0313cc1b1
--- /dev/null
+++ b/srcpkgs/startup/startup.fish
@@ -0,0 +1,17 @@
+# Options
+complete -r -F -c startup -l append-confdir -d 'Append directories to look for job configuration files'
+complete -r -F -c startup -l confdir -d 'Read job configurationo files from this directory rather than defaults'
+complete -x -c startup -l default-console -d 'Default value for "console" stanza'
+complete -f -c startup -l no-cgroups -d 'Do not honour cgroup stanza'
+complete -f -c startup -l no-dbus -d 'Do connect to a D-Bus bus'
+complete -f -c startup -l no-inherint-env -d 'Stop jobs from inheriting initial environment'
+complete -r -F -c startup -l logdir -d 'Write job output log files to this directory'
+complete -f -c startup -l no-log -d 'Disable logging of job output'
+complete -f -c startup -l no-session -d 'Disable chroot sessions'
+complete -f -c startup -l no-startup-event -d 'Do not emit initial startup event'
+complete -r -F -c startup -l prepend-confdir -d 'Prepend directories to look for job configuration files'
+complete -f -c startup -l session -d 'Connect to the D-Bus session bus'
+complete -x -c startup -l startup-event -d 'emit a different event at startup than the default one'
+complete -f -c starutp -s q -l quiet -d 'Only output errors'
+complete -f -c startup -s v -l verbose -d 'Output verbose messages about job state changes and event emissions'
+complete -f -c startup -l version -d 'Output version information and exit'
diff --git a/srcpkgs/startup/status.fish b/srcpkgs/startup/status.fish
new file mode 100644
index 000000000000..d52205a86e7e
--- /dev/null
+++ b/srcpkgs/startup/status.fish
@@ -0,0 +1,36 @@
+complete -f -c status -n "__fish_is_initctl" -a "(__fish_initctl_list_with_status)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
diff --git a/srcpkgs/startup/stop.fish b/srcpkgs/startup/stop.fish
new file mode 100644
index 000000000000..dcf0ab692b62
--- /dev/null
+++ b/srcpkgs/startup/stop.fish
@@ -0,0 +1,29 @@
+complete -f -c stop -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/template b/srcpkgs/startup/template
index eeeee53501a1..38d11dd643b7 100644
--- a/srcpkgs/startup/template
+++ b/srcpkgs/startup/template
@@ -1,7 +1,7 @@
 # Template file for 'startup'
 pkgname=startup
 version=2.0.2
-revision=3
+revision=4
 build_style=gnu-configure
 configure_args="--disable-sysvcompat --disable-dconf-bridge --disable-cgroups"
 make_dirs="/var/log/startup 0750 root adm"
@@ -22,6 +22,18 @@ pre_configure() {
 
 post_install() {
 	rm -f -- "${DESTDIR}/usr/lib/libupstart.la"
+
+	# Fish completion
+	vinstall ${FILESDIR}/startup.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/startup-monitor.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl2dot.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/init-checkconf.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/start.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/stop.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/reload.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/restart.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/status.fish 0644 /usr/share/fish/completions
 }
 
 startup-tools_package() {
@@ -33,6 +45,8 @@ startup-tools_package() {
 		vmove usr/share/icons
 		vmove usr/share/applications
 		vmove usr/share/man/man8/startup-monitor.8
+		vmove usr/share/fish/completions/startup-monitor.fish
+		vmove usr/share/fish/completions/initctl2dot.fish
 	}
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] startup: add completion for fish shell
  2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
                   ` (2 preceding siblings ...)
  2021-09-14  3:43 ` maxice8
@ 2021-09-14  3:50 ` maxice8
  2021-10-08 16:54 ` [PR PATCH] [Closed]: " Chocimier
  2021-10-08 16:54 ` Chocimier
  5 siblings, 0 replies; 7+ messages in thread
From: maxice8 @ 2021-09-14  3:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

There is an updated pull request by maxice8 against master on the void-packages repository

https://github.com/maxice8/void-packages startup
https://github.com/void-linux/void-packages/pull/32854

startup: add completion for fish shell
upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41


A patch file from https://github.com/void-linux/void-packages/pull/32854.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-startup-32854.patch --]
[-- Type: text/x-diff, Size: 20197 bytes --]

From 718870578cb3932dd2fb91d968b48018f9412297 Mon Sep 17 00:00:00 2001
From: Leo <thinkabit.ukim@gmail.com>
Date: Mon, 6 Sep 2021 07:14:57 +0000
Subject: [PATCH] startup: add completion for fish shell

upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41
---
 srcpkgs/startup/files/init-checkconf.fish  |   7 ++
 srcpkgs/startup/files/initctl.fish         | 125 +++++++++++++++++++++
 srcpkgs/startup/files/initctl2dot.fish     |  16 +++
 srcpkgs/startup/files/reload.fish          |  29 +++++
 srcpkgs/startup/files/restart.fish         |  29 +++++
 srcpkgs/startup/files/start.fish           |  29 +++++
 srcpkgs/startup/files/startup-monitor.fish |   5 +
 srcpkgs/startup/files/startup.fish         |  17 +++
 srcpkgs/startup/files/status.fish          |  36 ++++++
 srcpkgs/startup/files/stop.fish            |  29 +++++
 srcpkgs/startup/template                   |  16 ++-
 11 files changed, 337 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/startup/files/init-checkconf.fish
 create mode 100644 srcpkgs/startup/files/initctl.fish
 create mode 100644 srcpkgs/startup/files/initctl2dot.fish
 create mode 100644 srcpkgs/startup/files/reload.fish
 create mode 100644 srcpkgs/startup/files/restart.fish
 create mode 100644 srcpkgs/startup/files/start.fish
 create mode 100644 srcpkgs/startup/files/startup-monitor.fish
 create mode 100644 srcpkgs/startup/files/startup.fish
 create mode 100644 srcpkgs/startup/files/status.fish
 create mode 100644 srcpkgs/startup/files/stop.fish

diff --git a/srcpkgs/startup/files/init-checkconf.fish b/srcpkgs/startup/files/init-checkconf.fish
new file mode 100644
index 000000000000..d14b4b4b7054
--- /dev/null
+++ b/srcpkgs/startup/files/init-checkconf.fish
@@ -0,0 +1,7 @@
+# Global options
+complete -f -c init-checkconf -s d -l debug -d 'Show some debug output'
+complete -r -F -c init-checkconf -s f -l file -d 'Path to job configuration file to check'
+complete -r -F -c init-checkconf -s i -l initctl-path -d 'Path to initctl(8) binary'
+complete -f -c init-checkconf -s s -l noscript -d 'Do not check script sections'
+complete -r -F -c init-checkconf -s x -l startup-path -d 'Payh to startup(8) binary'
+complete -f -c init-checkconf -s h -l help -d 'Display usage statement'
diff --git a/srcpkgs/startup/files/initctl.fish b/srcpkgs/startup/files/initctl.fish
new file mode 100644
index 000000000000..0c5cc8a3445f
--- /dev/null
+++ b/srcpkgs/startup/files/initctl.fish
@@ -0,0 +1,125 @@
+# Global options
+complete -f -c initctl -l session -d 'Use existing session D-Bus session (for testing)'
+complete -f -c initctl -l system -d 'Use system D-Bus'
+complete -x -c initctl -l dest -d 'Name for the Startup daemon in system D-Bus'
+complete -f -c initctl -l user -d 'Run in user mode'
+complete -f -c initctl -s q -l quiet -d 'Only output errors'
+complete -f -c initctl -s v -l verbose -d 'Include informational messages'
+complete -f -c initctl -l help -d 'Show help'
+complete -f -c initctl -l version -d 'Output version information'
+
+# Job commands
+complete -f -c initctl -n __fish_use_subcommand -a start -d 'Start job'
+complete -f -c initctl -n __fish_use_subcommand -a stop -d 'Stop job'
+complete -f -c initctl -n __fish_use_subcommand -a restart -d 'Restart job'
+complete -f -c initctl -n __fish_use_subcommand -a reload -d 'Reload job'
+complete -f -c initctl -n __fish_use_subcommand -a status -d 'Query status of job'
+complete -f -c initctl -n __fish_use_subcommand -a list -d 'List known jobs'
+
+# Event commands
+complete -f -c initctl -n __fish_use_subcommand -a emit -d 'Emit an event'
+
+# Environment commands
+complete -f -c initctl -n __fish_use_subcommand -a get-env -d 'Retrieve value of a job environment variable'
+complete -f -c initctl -n __fish_use_subcommand -a list-env -d 'Show all job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a reset-env -d 'Revert all job environment variable changes'
+complete -f -c initctl -n __fish_use_subcommand -a set-env -d 'Set one or more job environment variables'
+complete -f -c initctl -n __fish_use_subcommand -a unset-env -d 'Remove one or more job environment variables'
+
+# Other commands
+complete -f -c initctl -n __fish_use_subcommand -a reload-configuration -d 'Reload init daemon configuration'
+complete -f -c initctl -n __fish_use_subcommand -a version -d 'Request version of the init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a log-priority -d 'Change minimum priority of log messages from init daemon'
+complete -f -c initctl -n __fish_use_subcommand -a show-config -d 'Show emits, start on and stop on defaults for a job'
+complete -f -c initctl -n __fish_use_subcommand -a check-config -d 'Check for unreachable jobs/event conditions'
+complete -f -c initctl -n __fish_use_subcommand -a usage -d 'Show job usage message if available'
+complete -f -c initctl -n __fish_use_subcommand -a notify-cgroup-manager-address -d 'Inform Upstart of D-Bus address cgroup manager is available on'
+complete -f -c initctl -n __fish_use_subcommand -a notify-dbus-address -d 'Inform Upstart of D-Bus address to connect to'
+complete -f -c initctl -n __fish_use_subcommand -a notify-disk-writeable -d 'Inform Upstart that disk is now writeable'
+complete -f -c initctl -n __fish_use_subcommand -a list-sessions -d 'List all sessions'
+complete -f -c initctl -n __fish_use_subcommand -a re-exec -d 'Perform stateful re-exec'
+complete -f -c initctl -n __fish_use_subcommand -a help -d 'Display list of commands'
+
+# -n|--no-wait for some of the Job commands
+complete -f -c initctl -n "__fish_seen_subcommand_from start stop restart emit" -s n -l no-wait -d 'Do not wait for action to return'
+
+# -r|--retain for some of the Environment commands
+complete -f -c initctl -n "__fish_seen_subcommand_from set-env unset-env reset-env" -s r -l retain -d 'Do not modify already set variables'
+
+# Offer all 'stop/waiting' jobs with 'start' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from start" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+# Offer all 'start/*' jobs with 'stop', 'reload' and 'restart' subcommands
+complete -f -c initctl -n "__fish_seen_subcommand_from stop reload restart" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+# Offer all jobs with its status to the 'status' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from status" -a "(__fish_initctl_list_with_status)"
+
+# Offer all jobs to the 'check-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -a "(__fish_initctl_run list | string split ' ' -f 1)" -d Job
+
+# Offer all envs from 'list-env' subcommand to 'get-env' and 'unset-env'
+complete -f -c initctl -n "__fish_seen_subcommand_from get-env unset-env" -a "(__fish_initctl_run list-env | string replace -r '=' '\tVariable: ')"
+
+# Possible priority levels for 'log-priority' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from log-priority" -a "debug info message warn error fatal" -d 'Priority'
+
+# -e|--enumerate option for 'show-config' subcommand
+complete -f -c initctl -n "__fish_seen_subcommand_from show-config" -s e -l enumerate -d 'Print per line each "start on" and "stop on" condition for each event or job'
+
+# -i|--ignore-events and -w|--warn for 'check-config' subcommand
+complete -x -c initctl -n "__fish_seen_subcommand_from check-config" -s i -l ignore-events -d 'Comma-separated list of events to ignore'
+complete -f -c initctl -n "__fish_seen_subcommand_from check-config" -s w -l warn -d 'treat any unknown jobs and events as errors'
+
+# Show all the events from 'emits' in configuration to emit
+complete -x -c initctl -n "__fish_seen_subcommand_from emit" -a "(__fish_initctl_get_events)" -d 'Event'
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
+
+function __fish_initctl_extract_events -d 'Extract emitted events from job configuration'
+	grep -E '^[[:space:]]*emits ' $argv/*.conf \
+	| cut -d : -f 2- \
+	| string replace 'emit ' '' \
+	| string replace ' ' \n \
+	| sort -u
+end
+
+function __fish_initctl_get_events -d 'Print all events that jobs in the current context emit'
+	switch (__fish_initctl_context)
+		case system
+			set -l dirs /etc/startup /etc/init /usr/share/start /usr/share/xdg/startup
+			for d in (string replace : ' ' $XDG_CONFIG_DIRS)
+				set -l dirs $dirs $d/startup $d/upstart
+			end
+			__fish_initctl_extract_events $dirs
+		case user session
+			if set -q XDG_CONFIG_HOME
+				__fish_initctl_extract_events $XDG_CONFIG_HOME/startup $XDG_CONFIG_HOME/upstart
+			else
+				__fish_initctl_extract_events $HOME/.config/startup $HOME/.config/upstart
+			end
+	end
+end
diff --git a/srcpkgs/startup/files/initctl2dot.fish b/srcpkgs/startup/files/initctl2dot.fish
new file mode 100644
index 000000000000..868bd9b5dbf8
--- /dev/null
+++ b/srcpkgs/startup/files/initctl2dot.fish
@@ -0,0 +1,16 @@
+# global options
+complete -x -c initctl2dot -s f -l infile -d 'File to read initctl(8) output from instead of (initctl show-config -e)'
+complete -f -c initctl2dot -s h -l help -d 'Display usage statement'
+complete -x -c initctl2dot -s r -l restrict-to-jobs -d 'Comma-separated list of jobs to consider instead of all jobs'
+complete -x -c initctl2dot -s w -l outfile -d 'File to write output to'
+complete -x -c initctl2dot -l color-emits -d 'Color for "emits" lines'
+complete -x -c initctl2dot -l color-start-on -d 'Color for "start on" lines'
+complete -x -c initctl2dot -l color-stop-on -d 'Color for "stop on" lines'
+complete -x -c initctl2dot -l color-event -d 'Color for event boxes'
+complete -x -c initctl2dot -l color-text -d 'Color for text in summary'
+complete -x -c initctl2dot -l color-bg -d 'Color for background of the diagram'
+complete -x -c initctl2dot -l color-event-text -d 'Color for text for event boxes'
+complete -x -c initctl2dot -l color-job-text -d 'Color for text in job boxes'
+complete -x -c initctl2dot -l color-job -d 'Color for job boxes'
+complete -f -c initctl2dot -l system -d 'Connect to the system session'
+complete -f -c initctl2dot -l user -d 'Connect to the user session'
diff --git a/srcpkgs/startup/files/reload.fish b/srcpkgs/startup/files/reload.fish
new file mode 100644
index 000000000000..8fd9d500a739
--- /dev/null
+++ b/srcpkgs/startup/files/reload.fish
@@ -0,0 +1,29 @@
+complete -f -c reload -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/files/restart.fish b/srcpkgs/startup/files/restart.fish
new file mode 100644
index 000000000000..8b246534920a
--- /dev/null
+++ b/srcpkgs/startup/files/restart.fish
@@ -0,0 +1,29 @@
+complete -f -c restart -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/files/start.fish b/srcpkgs/startup/files/start.fish
new file mode 100644
index 000000000000..514a6db251f2
--- /dev/null
+++ b/srcpkgs/startup/files/start.fish
@@ -0,0 +1,29 @@
+complete -f -c start -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire stop/waiting | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/files/startup-monitor.fish b/srcpkgs/startup/files/startup-monitor.fish
new file mode 100644
index 000000000000..70fa34ea29cb
--- /dev/null
+++ b/srcpkgs/startup/files/startup-monitor.fish
@@ -0,0 +1,5 @@
+# Global options
+complete -x -c startup-monitor -s d -l destination -d 'Which endpoint to connect to' -a "session-socket session-system system-socket system-bus"
+complete -f -c startup-monitor -s h -l help -d 'Show brief usage summary'
+complete -f -c startup-monitor -s n -l no-gui -d 'Run in command-line mode'
+complete -x -c startup-monitor -s s -l separator -d 'Specify alternate field separator for command-line output'
diff --git a/srcpkgs/startup/files/startup.fish b/srcpkgs/startup/files/startup.fish
new file mode 100644
index 000000000000..56b0313cc1b1
--- /dev/null
+++ b/srcpkgs/startup/files/startup.fish
@@ -0,0 +1,17 @@
+# Options
+complete -r -F -c startup -l append-confdir -d 'Append directories to look for job configuration files'
+complete -r -F -c startup -l confdir -d 'Read job configurationo files from this directory rather than defaults'
+complete -x -c startup -l default-console -d 'Default value for "console" stanza'
+complete -f -c startup -l no-cgroups -d 'Do not honour cgroup stanza'
+complete -f -c startup -l no-dbus -d 'Do connect to a D-Bus bus'
+complete -f -c startup -l no-inherint-env -d 'Stop jobs from inheriting initial environment'
+complete -r -F -c startup -l logdir -d 'Write job output log files to this directory'
+complete -f -c startup -l no-log -d 'Disable logging of job output'
+complete -f -c startup -l no-session -d 'Disable chroot sessions'
+complete -f -c startup -l no-startup-event -d 'Do not emit initial startup event'
+complete -r -F -c startup -l prepend-confdir -d 'Prepend directories to look for job configuration files'
+complete -f -c startup -l session -d 'Connect to the D-Bus session bus'
+complete -x -c startup -l startup-event -d 'emit a different event at startup than the default one'
+complete -f -c starutp -s q -l quiet -d 'Only output errors'
+complete -f -c startup -s v -l verbose -d 'Output verbose messages about job state changes and event emissions'
+complete -f -c startup -l version -d 'Output version information and exit'
diff --git a/srcpkgs/startup/files/status.fish b/srcpkgs/startup/files/status.fish
new file mode 100644
index 000000000000..d52205a86e7e
--- /dev/null
+++ b/srcpkgs/startup/files/status.fish
@@ -0,0 +1,36 @@
+complete -f -c status -n "__fish_is_initctl" -a "(__fish_initctl_list_with_status)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
+
+function __fish_initctl_list_with_status -d 'Get Job and status from initctl'
+	__fish_initctl_run list \
+		| cut -d ' ' -f 1-2 \
+		| string replace -r ',$' '' \
+		| string replace -r ' ' '\tJob: '
+end
diff --git a/srcpkgs/startup/files/stop.fish b/srcpkgs/startup/files/stop.fish
new file mode 100644
index 000000000000..dcf0ab692b62
--- /dev/null
+++ b/srcpkgs/startup/files/stop.fish
@@ -0,0 +1,29 @@
+complete -f -c stop -n "__fish_is_initctl" -a "(__fish_initctl_run list | string match --entire start/running | string split ' ' -f 1)" -d Job
+
+function __fish_is_initctl -d 'Follow symlinks to check if given binary is initctl'
+	set -l cmd (commandline -poc)
+	set -l cmd $cmd[1] # Binary
+	set -l fullcmd (realpath (which $cmd))
+	if [ (basename $fullcmd) = initctl ];
+		return 0
+	end
+	return 1
+end
+
+function __fish_initctl_context -d 'Get the current startup context based on the commandline'
+	if __fish_seen_argument -l user
+		echo -- user
+	else if __fish_seen_argument -l session
+		echo -- session
+	else if __fish_seen_argument -l system
+		echo -- system
+	else if set -q UPSTART_SESSION
+		echo -- user
+	else
+		echo -- system
+	end
+end
+
+function __fish_initctl_run -d 'Run initctl with the appropriate context'
+	initctl --(__fish_initctl_context) $argv
+end
diff --git a/srcpkgs/startup/template b/srcpkgs/startup/template
index eeeee53501a1..38d11dd643b7 100644
--- a/srcpkgs/startup/template
+++ b/srcpkgs/startup/template
@@ -1,7 +1,7 @@
 # Template file for 'startup'
 pkgname=startup
 version=2.0.2
-revision=3
+revision=4
 build_style=gnu-configure
 configure_args="--disable-sysvcompat --disable-dconf-bridge --disable-cgroups"
 make_dirs="/var/log/startup 0750 root adm"
@@ -22,6 +22,18 @@ pre_configure() {
 
 post_install() {
 	rm -f -- "${DESTDIR}/usr/lib/libupstart.la"
+
+	# Fish completion
+	vinstall ${FILESDIR}/startup.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/startup-monitor.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/initctl2dot.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/init-checkconf.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/start.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/stop.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/reload.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/restart.fish 0644 /usr/share/fish/completions
+	vinstall ${FILESDIR}/status.fish 0644 /usr/share/fish/completions
 }
 
 startup-tools_package() {
@@ -33,6 +45,8 @@ startup-tools_package() {
 		vmove usr/share/icons
 		vmove usr/share/applications
 		vmove usr/share/man/man8/startup-monitor.8
+		vmove usr/share/fish/completions/startup-monitor.fish
+		vmove usr/share/fish/completions/initctl2dot.fish
 	}
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Closed]: startup: add completion for fish shell
  2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
                   ` (3 preceding siblings ...)
  2021-09-14  3:50 ` maxice8
@ 2021-10-08 16:54 ` Chocimier
  2021-10-08 16:54 ` Chocimier
  5 siblings, 0 replies; 7+ messages in thread
From: Chocimier @ 2021-10-08 16:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

There's a closed pull request on the void-packages repository

startup: add completion for fish shell
https://github.com/void-linux/void-packages/pull/32854

Description:
upstream: https://gitlab.com/chinstrap/startup/-/merge_requests/41


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: startup: add completion for fish shell
  2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
                   ` (4 preceding siblings ...)
  2021-10-08 16:54 ` [PR PATCH] [Closed]: " Chocimier
@ 2021-10-08 16:54 ` Chocimier
  5 siblings, 0 replies; 7+ messages in thread
From: Chocimier @ 2021-10-08 16:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

New comment by Chocimier on void-packages repository

https://github.com/void-linux/void-packages/pull/32854#issuecomment-938850804

Comment:
Resolved by https://github.com/void-linux/void-packages/commit/8ec98c80c0f4d8eb0efc345cfdd69501153547f1.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-08 16:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  7:17 [PR PATCH] startup: add completion for fish shell maxice8
2021-09-06  7:35 ` [PR PATCH] [Updated] " maxice8
2021-09-06 23:20 ` maxice8
2021-09-14  3:43 ` maxice8
2021-09-14  3:50 ` maxice8
2021-10-08 16:54 ` [PR PATCH] [Closed]: " Chocimier
2021-10-08 16:54 ` Chocimier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).