101 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#compdef distrobox
 | 
						|
 | 
						|
_distrobox() {
 | 
						|
  local context curcontext="$curcontext" state line ret=1
 | 
						|
  typeset -A opt_args
 | 
						|
 | 
						|
  _arguments -C \
 | 
						|
    '(-h --help)'{-h,--help}'[show help]' \
 | 
						|
    '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
    '1: :->command' \
 | 
						|
    '*:: :->arguments'
 | 
						|
 | 
						|
  case $state in;
 | 
						|
    (command)
 | 
						|
      local commands;
 | 
						|
      commands=(
 | 
						|
        'create:create the distrobox'
 | 
						|
        'enter:enter the distrobox'
 | 
						|
        'export:application and service exporting'
 | 
						|
        'list:list containers'
 | 
						|
        'rm:remove containers'
 | 
						|
        'stop:stop containers'
 | 
						|
      )
 | 
						|
      _describe -t commands 'distrobox command' commands "$@" \
 | 
						|
        && ret=0 ;;
 | 
						|
 | 
						|
    (arguments)
 | 
						|
      case $line[1] in
 | 
						|
        (create)
 | 
						|
          _arguments \
 | 
						|
            '(-h --help)'{-h,--help}'[show this message]' \
 | 
						|
            '(-v --verbose)'{-v,--verbose}'[show more verbosity]' \
 | 
						|
            '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
            '(-i --image)'{-i,--image}'[image to use for the container]: :' \
 | 
						|
            '(-n --name)'{-n,--name}'[name for the distrobox]: :' \
 | 
						|
            '(-H --home)'{-H,--home}'[select a custom HOME directory for the container]: :' \
 | 
						|
            '*--volume[additional volumes to add to the container]: :_directories' \
 | 
						|
            '(-a --additional-flags)'{-a,--additional-flags}'[additional flags to pass to the container manager command]: :' \
 | 
						|
            '(-I --init)'{-I,--init}'[use init system (like systemd) inside the container]: :' \
 | 
						|
            '(-d --dry-run)'{-d,--dry-run}'[only print the container manager command generated]' \
 | 
						|
            && ret=0 ;;
 | 
						|
 | 
						|
        (enter)
 | 
						|
          _arguments -S \
 | 
						|
            '(-h --help)'{-h,--help}'[show this message]' \
 | 
						|
            '(-v --verbose)'{-v,--verbose}'[show more verbosity]' \
 | 
						|
            '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
            '(-n --name)'{-n,--name}'[name for the distrobox]: :' \
 | 
						|
            '(-T --no-tty)'{-T,--no-tty}'[do not instantiate a tty]' \
 | 
						|
            '(-a --additional-flags)'{-a,--additional-flags}'[additional flags to pass to the container manager command]: :' \
 | 
						|
            '(-d --dry-run)'{-d,--dry-run}'[only print the container manager command generated]' \
 | 
						|
            '(-e --)'{-e,--}'[end arguments execute the rest as command to execute at login]:*:' \
 | 
						|
            && ret=0 ;;
 | 
						|
 | 
						|
        (export)
 | 
						|
          _arguments -S \
 | 
						|
            '(-h --help)'{-h,--help}'[show this message]' \
 | 
						|
            '(-v --verbose)'{-v,--verbose}'[show more verbosity]' \
 | 
						|
            '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
            '(-a --app)'{-a,--app}'[name of the application to export]: :' \
 | 
						|
            '(-b --bin)'{-b,--bin}'[absolute path of the binary to export]: :' \
 | 
						|
            '(-s --service)'{-s,--service}'[name of the service to export]: :' \
 | 
						|
            '(-d --delete)'{-d,--delete}'[delete exported application or service]: :' \
 | 
						|
            '(-el --export-label)'{-el,--export-label}'[label to add to exported application name]: :' \
 | 
						|
            '(-ep --export-path)'{-ep,--export-path}'[path where to export the binary]: :' \
 | 
						|
            '(-ef --extra-flags)'{-ef,--export-flags}'[extra flags to add to the command]: :' \
 | 
						|
            '(-S --sudo)'{-S,--sudo}'[specify if the exported item should be run as sudo]' \
 | 
						|
            && ret=0 ;;
 | 
						|
 | 
						|
        (list)
 | 
						|
          _arguments -S \
 | 
						|
            '(-h --help)'{-h,--help}'[show this message]' \
 | 
						|
            '(-v --verbose)'{-v,--verbose}'[show more verbosity]' \
 | 
						|
            '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
            && ret=0 ;;
 | 
						|
 | 
						|
        (rm)
 | 
						|
          _arguments -S \
 | 
						|
            '(-h --help)'{-h,--help}'[show this message]' \
 | 
						|
            '(-v --verbose)'{-v,--verbose}'[show more verbosity]' \
 | 
						|
            '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
            '(-n --name)'{-n,--name}'[name for the distrobox]: :' \
 | 
						|
            '(-f --force)'{-f,--force}'[force deletion]' \
 | 
						|
            && ret=0 ;;
 | 
						|
 | 
						|
        (stop)
 | 
						|
          _arguments -S \
 | 
						|
            '(-h --help)'{-h,--help}'[show this message]' \
 | 
						|
            '(-v --verbose)'{-v,--verbose}'[show more verbosity]' \
 | 
						|
            '(-V --version)'{-V,--version}'[show version]' \
 | 
						|
            '(-n --name)'{-n,--name}'[name for the distrobox]: :' \
 | 
						|
            '(-Y --yes)'{-Y,--yes}'[non-interactive, stop without asking]' \
 | 
						|
            && ret=0 ;;
 | 
						|
      esac ;;
 | 
						|
  esac
 | 
						|
 | 
						|
  return $ret
 | 
						|
}
 | 
						|
 | 
						|
_distrobox "$@"
 |