All checks were successful
		
		
	
	Test / Create distribution (push) Successful in 25s
				
			Test / Sandbox (push) Successful in 39s
				
			Test / Sandbox (race detector) (push) Successful in 39s
				
			Test / Hakurei (push) Successful in 42s
				
			Test / Hpkg (push) Successful in 40s
				
			Test / Hakurei (race detector) (push) Successful in 44s
				
			Test / Flake checks (push) Successful in 1m23s
				
			Sharing and persisting these directories do not always make sense. Make it optional here. Closes #16. Signed-off-by: Ophestra <cat@gensokyo.uk>
		
			
				
	
	
		
			84 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #compdef hakurei
 | |
| 
 | |
| _hakurei_app() {
 | |
|   __hakurei_files
 | |
|   return $?
 | |
| }
 | |
| 
 | |
| _hakurei_run() {
 | |
|   _arguments \
 | |
|     '--id[Reverse-DNS style Application identifier, leave empty to inherit instance identifier]:id' \
 | |
|     '-a[Application identity]: :_numbers' \
 | |
|     '-g[Groups inherited by all container processes]: :_groups' \
 | |
|     '-d[Container home directory]: :_files -/' \
 | |
|     '-u[Passwd user name within sandbox]: :_users' \
 | |
|     '--private-runtime[Do not share XDG_RUNTIME_DIR between containers under the same identity]' \
 | |
|     '--private-tmpdir[Do not share TMPDIR between containers under the same identity]' \
 | |
|     '--wayland[Enable connection to Wayland via security-context-v1]' \
 | |
|     '-X[Enable direct connection to X11]' \
 | |
|     '--dbus[Enable proxied connection to D-Bus]' \
 | |
|     '--pulse[Enable direct connection to PulseAudio]' \
 | |
|     '--dbus-config[Path to session bus proxy config file]: :_files -g "*.json"' \
 | |
|     '--dbus-system[Path to system bus proxy config file]: :_files -g "*.json"' \
 | |
|     '--mpris[Allow owning MPRIS D-Bus path]' \
 | |
|     '--dbus-log[Force buffered logging in the D-Bus proxy]'
 | |
| }
 | |
| 
 | |
| _hakurei_ps() {
 | |
|   _arguments \
 | |
|     '--short[List instances only]'
 | |
| }
 | |
| 
 | |
| _hakurei_show() {
 | |
|   _alternative \
 | |
|     'instances:domains:__hakurei_instances' \
 | |
|     'files:files:__hakurei_files'
 | |
| }
 | |
| 
 | |
| __hakurei_files() {
 | |
|   _files -g "*.(json|hakurei)"
 | |
|   return $?
 | |
| }
 | |
| 
 | |
| __hakurei_instances() {
 | |
|   local -a out
 | |
|   shift -p
 | |
|   out=( ${(f)"$(_call_program commands hakurei ps --short 2>&1)"} )
 | |
|   if (( $#out == 0 )); then
 | |
|     _message "No active instances"
 | |
|   else
 | |
|     _describe "active instances" out
 | |
|   fi
 | |
|   return $?
 | |
| }
 | |
| 
 | |
| (( $+functions[_hakurei_commands] )) || _hakurei_commands()
 | |
| {
 | |
|   local -a _hakurei_cmds
 | |
|   _hakurei_cmds=(
 | |
|     "app:Load and start container from configuration file"
 | |
|     "run:Configure and start a permissive container"
 | |
|     "show:Show live or local app configuration"
 | |
|     "ps:List active instances"
 | |
|     "version:Display version information"
 | |
|     "license:Show full license text"
 | |
|     "template:Produce a config template"
 | |
|     "help:Show help message"
 | |
|   )
 | |
|   if (( CURRENT == 1 )); then
 | |
|     _describe -t commands 'action' _hakurei_cmds || compadd "$@"
 | |
|   else
 | |
|     local curcontext="$curcontext"
 | |
|     cmd="${${_hakurei_cmds[(r)$words[1]:*]%%:*}}"
 | |
|     if (( $+functions[_hakurei_$cmd] )); then
 | |
|       _hakurei_$cmd
 | |
|     else
 | |
|       _message "no more options"
 | |
|     fi
 | |
|   fi
 | |
| }
 | |
| 
 | |
| _arguments -C \
 | |
|   '-v[Increase log verbosity]' \
 | |
|   '--json[Serialise output in JSON when applicable]' \
 | |
|   '*::hakurei command:_hakurei_commands' |