Compare commits

..

10 Commits

Author SHA1 Message Date
Shohei YOSHIDA b9f1efca5b
Merge pull request #1194 from zsh-users/refactoring-emacs
merge emacs and emacsclient completion file
2025-12-13 01:40:20 +09:00
Shohei YOSHIDA 0677484d25
Merge pull request #1196 from zsh-users/refactor_mussh
Refactoring mussh completion and implement TODOs
2025-12-13 01:40:05 +09:00
Shohei YOSHIDA 9c57177447
Merge pull request #1197 from zsh-users/remove-rkt
Remove rkt completion
2025-12-13 01:39:44 +09:00
Shohei YOSHIDA 7fdc6c0fa2
Merge pull request #1198 from zsh-users/remove-fleetctl
Remove fleetctl
2025-12-13 01:39:33 +09:00
Shohei YOSHIDA 0cc8dfaea5
Remove rkt completion
It is no longer maintained
2025-12-13 00:43:51 +09:00
Shohei YOSHIDA 0f6ab54b85
Remove fleetctl
It is no longer maintained
2025-12-13 00:40:56 +09:00
Shohei YOSHIDA 91256ebd52
Refactoring mussh completion and implement TODOs 2025-12-12 19:51:26 +09:00
Shohei YOSHIDA b07586490b
Merge pull request #1195 from zsh-users/remove_rsvm
Remove rsvm completion
2025-12-12 19:38:44 +09:00
Shohei YOSHIDA 1f7907894f
Remove rsvm completion 2025-12-12 18:46:14 +09:00
Shohei YOSHIDA 8ec4565397
merge emacs and emacsclient completion file 2025-12-12 17:19:08 +09:00
6 changed files with 102 additions and 735 deletions

View File

@ -1,4 +1,4 @@
#compdef emacs
#compdef emacs emacsclient
# ------------------------------------------------------------------------------
# Copyright (c) 2022 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
@ -35,16 +35,17 @@
#
# ------------------------------------------------------------------------------
_arguments \
case $service in
(emacs)
_arguments -s \
'--batch[do not do interactive display, implies -q]' \
'--chdir[change to directory]: :_files -/' \
'(--daemon --bg-daemon --fg-daemon)--daemon[start a server in the background]' \
'(--daemon --bg-daemon --fg-daemon)--bg-daemon=-[start a named server in the background]::name' \
'(--daemon --bg-daemon --fg-daemon)--fg-daemon=-[start a named server in the foreground]' \
'--chdir[change to directory]:dir:_files -/' \
'(--daemon --bg-daemon --fg-daemon)'{--daemon,--bg-daemon=-}'[start a named server in the background]::name' \
'(--daemon --bg-daemon --fg-daemon)--fg-daemon=-[start a named server in the foreground]::name' \
'--debug-init[enable Emacs Lisp debugger for init file]' \
'(-d --display)'{-d,--display}'[use X server DISPLAY]:display' \
'(-d --display)'{-d,--display}'[use X server DISPLAY]:display:_x_display' \
'--module-assertions[assert behavior of dynamic modules]' \
'--dump-file[read dumped state from FILE]: :_files' \
'--dump-file[read dumped state from FILE]:file:_files' \
'(- *)--fingerprint[output fingerprint and exit]' \
'--seccomp=[read Seccomp BPF filter from FILE]: :_files' \
'--no-build-details[do not add build details such as time stamps]' \
@ -56,12 +57,12 @@ _arguments \
'(-nsl --no-site-lisp)'{-nsl,--no-site-lisp}'[do not add site-lisp directories to load-path]' \
'--no-splash[do not display a splash screen on startup]' \
'(-nw --no-window-system)'{-nw,--no-window-system}'[do not communicate with X, ignoring $DISPLAY]' \
'--init-directory=[use DIR when looking for the Emacs init files]: :_files -/' \
'--init-directory=[use DIR when looking for the Emacs init files]:dir:_files -/' \
'(-Q --quick)'{-Q,--quick}'[equivalent to -q --no-site-file --no-site-lisp --no-splash --no-x-resources]' \
'--script[run FILE as an Emacs Lisp script]: :_files' \
'--script[run FILE as an Emacs Lisp script]:file:_files' \
'-x[same as -Q --script]' \
'(-t --terminal)'{-t,--terminal}'[use DEVICE for terminal IO]: :_files' \
'(-u --user)'{-u,--user}'[load ~USER/.emacs instead of your own]' \
'(-u --user)'{-u,--user}"[load user's init file instead of your own]" \
\*{-L,--directory}'[prepend DIR to load-path(with :DIR, append DIR)]: :_files -/' \
{--eval,--execute}'[evaluate Emacs Lisp expression EXPR]:expr' \
\*{--file,--find-file,--visit}'[visit FILE]: :_files' \
@ -95,7 +96,31 @@ _arguments \
'--parent-id[set parent window]:xid' \
'(- *)--help{display help and exit}' \
'(- *)--version[output version information and exit]' \
'*: :_files'
'*:: :_files'
;;
(emacsclient)
_arguments -s -n : \
'(- *)'{-V,--version}'[Print version information and exit]' \
'(- *)'{-H,--help}'[Print this usage information message and exit]' \
'(-nw -t --tty --no-window-system)'{-nw,-t,--tty,--no-window-system}'[Open a new Emacs frame on the current terminal]' \
'(-c --create-frame)'{-c,--create-frame}'[Create a new frame instead of trying to use the current Emacs frame]' \
'(-r --reuse-frame)'{-r,--reuse-frame}'[Create a new frame if none exists, otherwise use the current Emacs frame]' \
'(-F --frame-parameters)'{-F,--frame-parameters=}'[Set the parameters of a new frame]:alist' \
'(-e --eval)'{-e,--eval}'[Evaluate as Emacs Lisp expressions]' \
'(-n --no-wait)'{-n,--no-wait}'[Returns immediately without waiting for finish]' \
'(-w --timeout)'{-w,--timeout=}'[Seconds to wait before timing out]:seconds' \
'(-q --quiet)'{-q,--quiet}"[Don't display messages on success]" \
'(-u --suppress-output)'{-u,--suppress-output}"[Don't display return values from the server]" \
'(-d --display)'{-d,--display=}'[Tell the server to display the files on the given display]:display:_x_display' \
'--parent-id=[Open in parent window ID, via XEmbed]' \
'(-s --socket-name)'{-s,--socket-name=}'[Set filename of the UNIX socket for communication]: :_files' \
'(-f --server-file)'{-f,--server-file=}'[Set filename of the TCP authentication file]: :_files' \
'(-a --alternate-editor)'{-a,--alternate-editor=}'[Editor to fallback to if the server is not running if EDITOR is the empty string]:editor:_files' \
'(-T --tramp)'{-T,--tramp=}'[PREFIX to prepend to filenames sent by emacsclient for locating files remotely via Tramp]:prefix' \
'*:: :_files'
;;
esac
# Local Variables:
# mode: Shell-Script

View File

@ -1,66 +0,0 @@
#compdef emacsclient
#
# ------------------------------------------------------------------------------
# Copyright (c) 2022 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for emacsclient 29
# - https://www.gnu.org/software/emacs/manual/html_node/emacs/Invoking-emacsclient.html
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Shohei YOSHIDA (https://github.com/syohex)
#
# ------------------------------------------------------------------------------
_arguments -s -n : \
'(- *)'{-V,--version}'[Print version information and exit]' \
'(- *)'{-H,--help}'[Print this usage information message and exit]' \
'(-nw -t --tty)'{-nw,-t,--tty}'[Open a new Emacs frame on the current terminal]' \
'(-c --create-frame)'{-c,--create-frame}'[Create a new frame instead of trying to use the current Emacs frame]' \
'(-r --reuse-frame)'{-r,--reuse-frame}'[Create a new frame if none exists, otherwise use the current Emacs frame]' \
'(-F --frame-parameters)'{-F,--frame-parameters=}'[Set the parameters of a new frame]:alist' \
'(-e --eval)'{-e,--eval}'[Evaluate as Emacs Lisp expressions]' \
'(-n --no-wait)'{-n,--no-wait}'[Returns immediately without waiting for finish]' \
'(-w --timeout)'{-w,--timeout=}'[Seconds to wait before timing out]:seconds' \
'(-q --quiet)'{-q,--quiet}"[Don't display messages on success]" \
'(-u --suppress-output)'{-u,--suppress-output}"[Don't display return values from the server]" \
'(-d --display)'{-d,--display=}'[Tell the server to display the files on the given display]:display:_x_display' \
'--parent-id=[Open in parent window ID, via XEmbed]' \
'(-s --socket-name)'{-s,--socket-name=}'[Set filename of the UNIX socket for communication]: :_files' \
'(-f --server-file)'{-f,--server-file=}'[Set filename of the TCP authentication file]: :_files' \
'(-a --alternate-editor)'{-a,--alternate-editor=}'[Editor to fallback to if the server is not running if EDITOR is the empty string]:editor:_files' \
'(-T --tramp)'{-T,--tramp=}'[PREFIX to prepend to filenames sent by emacsclient for locating files remotely via Tramp]:prefix' \
'*: :_files'
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,123 +0,0 @@
#compdef fleetctl
# ------------------------------------------------------------------------------
# Copyright (c) 2009-2015 Robby Russell and contributors (see
# https://github.com/ohmyzsh/ohmyzsh/graphs/contributors)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for fleetctl (https://github.com/coreos/fleet).
#
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Remi Paulmier (https://github.com/shtouff)
#
# ------------------------------------------------------------------------------
# fleetctl zsh completion
local -a _1st_arguments
_1st_arguments=(
'cat:Output the contents of a submitted unit'
'destroy:Destroy one or more units in the cluster'
'fd-forward:Proxy stdin and stdout to a unix domain socket'
'help:Show a list of commands or help for one command'
'journal:Print the journal of a unit in the cluster to stdout'
'list-machines:Enumerate the current hosts in the cluster'
'list-unit-files:List the units that exist in the cluster.'
'list-units:List the current state of units in the cluster'
'load:Schedule one or more units in the cluster, first submitting them if necessary.'
'ssh:Open interactive shell on a machine in the cluster'
'start:Instruct systemd to start one or more units in the cluster, first submitting and loading if necessary.'
'status:Output the status of one or more units in the cluster'
'stop:Instruct systemd to stop one or more units in the cluster.'
'submit:Upload one or more units to the cluster without starting them'
'unload:Unschedule one or more units in the cluster.'
'version:Print the version and exit'
)
__task_list ()
{
local expl
declare -a tasks
tasks=(cat destroy fd-forward help journal list-machines list-unit-files \
list-units load ssh start status stop submit unload version)
_wanted tasks expl 'help' compadd $tasks
}
__unit_list ()
{
_wanted application expl 'command' compadd $(command fleetctl list-units | \
tail -n +2 | awk '{print $1}')
}
local expl
local curcontext="$curcontext" state line
local -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _1st_arguments
return
;;
(options)
case $line[1] in
(help)
_arguments ':feature:__task_list'
;;
(destroy|journal|start|status|stop|unload|cat)
_arguments '*:feature:__unit_list'
;;
(load|submit)
_arguments '*:file:_files -g *.service'
;;
(ssh)
_arguments '*:host:_hosts'
;;
(*)
_arguments '*:file:_files'
;;
esac
;;
esac
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -38,44 +38,32 @@
#
# ------------------------------------------------------------------------------
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
# TODO:
# -i: admit more than one use
# -d, -v, -t: control input
# -m: Accept number (but also empty)
# -h: Accept multiple hosts, also more than one use
# -H: Accept multiple files, also more than one use
_arguments -C \
'--help[display this help message]' \
'-V[print version info and exit]' \
'-d[Verbose debug]:level (from 0 to 2)' \
'-v[SSH debug level]:level (from 0 to 3)' \
'-m[Run concurrently]' \
'(-b -B)-b[Print each hosts output in a block without mingling with other hosts output]' \
'(-b -B)-B[Allow hosts output to mingle. (default)]' \
_arguments \
'(- *)--help[display this help message]' \
'-d-[Verbose debug]:level:(0 1 2)' \
'-v-[SSH debug levels]:level:(0 1 2 3)' \
'-m-[Run concurrently on the specified hosts at a time. "0" is used for infinite]:count' \
'-q[No output unless necessary]' \
'*-i[Load an identity file. May be used more than once]:identity:_files' \
'-o[Args to pass to ssh with -o option]:ssh-args' \
'(-a -A)-a[Force loading ssh-agent]' \
'(-a -A)-A[Do NOT load ssh-agent]' \
'(-b -B)-b[Print each hosts output in a block without mingling with other hosts output]' \
'(-b -B)-B[Allow hosts output to mingle. (default)]' \
'(-u -U)-u[Unique. Eliminate duplicate hosts. (default)]' \
'(-u -U)-U[Do NOT make host list unique]' \
'-P[Do NOT fall back to passwords on any host. This will skip hosts where keys fail]' \
'-i[Load an identity file. May be used more than once]:identity' \
'-o[Args to pass to ssh with -o option]:ssh-args' \
'(-l -L)-l[Use _login_ when no other is specified with the hostname]:login' \
'(-l -L)-L[Force use of _login_ on all hosts]:login' \
'-s[Path to shell on remote host]:shell' \
'-t[Timeout setting for each session]:timeout' \
'-p[Host to use as proxy]:[user@]host' \
'(- *)-V[print version info and exit]' \
'-p[Host to use as proxy]:[user@]host:_hosts' \
'-po[Args to pass to ssh on proxy with -o option]:ssh-args' \
'(-h -H)-h[Add a host to list of hosts]:[user@]host' \
'(-h -H)-H[Add contents of file to list of hosts]:host file:_files' \
'*-h[Add a host to list of hosts]:user@host' \
'*-H[Add contents of file to list of hosts]:host file:_files' \
'(-c -C)-c[Add a command or quoted list of commands to list of commands to be executed on each host]:command' \
'(-c -C)-C[Add file contents to list of commands to be executed on each host]:commands file:_files' \
'(-q)-q[No output unless necessary]' && ret=0
return ret
'(-c -C)-C[Add file contents to list of commands to be executed on each host]:commands file:_files'
# Local Variables:
# mode: Shell-Script

369
src/_rkt
View File

@ -1,369 +0,0 @@
#compdef rkt
# ------------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for rkt (https://coreos.com/rkt/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
#
# ------------------------------------------------------------------------------
typeset -A opt_args
autoload -U regexp-replace
_rkt() {
_arguments \
'--debug[print out more debug information to stderr]' \
'--dir=[rkt data directory]:data directory:_files -/' \
'--insecure-options=[comma-separated list of security features to disable]:option:{_values -s , none image tls ondisk http all}' \
'--local-config=[local configuration directory]:configuration directory:_files -/' \
'--system-config=[system configuration directory]:configuration directory:_files -/' \
'--trust-keys-from-https[automatically trust gpg keys fetched from https]' \
'--user-config=[user configuration directory]:configuration directory:_files -/' \
'--help' \
'1: :_rkt_cmds' \
'*:: :->rkt_cmd_args'
case $state in
rkt_cmd_args)
case $words[1] in
help)
_arguments \
'1: :_rkt_cmds' \
'*:: :->rkt_help_args' \
;;
api-service)
_arguments \
'--listen=[address to listen for client API requests]:address' \
;;
cat-manifest)
_arguments \
'--pretty-print[apply indent to format the output]' \
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
'1:POD:_rkt_pods' \
;;
config)
_arguments \
'--pretty-print[apply indent to format the output]' \
;;
enter)
_arguments \
'--app=:appname' \
'1:POD:_rkt_pods' \
;;
export)
_arguments \
'--app=:appname' \
'--overwrite[overwrite output ACI]' \
'1:POD:_rkt_pods' \
'2:OUTPUT_ACI_FILE:_files' \
;;
fetch)
_arguments \
'--full[print the full image hash after fetching]' \
'--no-store[fetch images ignoring the local store]' \
'--signature=[local signature file to use in validating the preceding image]:signature:_files' \
'--store-only[use only available images in the store]' \
;;
gc)
_arguments \
'--grace-period=[duration to wait before discarding inactive pods from garbage]:duration' \
'--expire-prepared=[duration to wait before expiring prepared pods]:duration' \
'--mark-only[move to the garbage directories without actually deleting]' \
;;
image)
_arguments \
'1: :_rkt_image_cmds' \
'*:: :->rkt_image_args'
;;
list)
_arguments \
'--full[use long output format]' \
'--no-legend[suppress a legend with the list]' \
;;
metadata-service)
_arguments \
'--listen-port=[listen port]:port' \
;;
prepare)
# TODO: autocomplete stage1 images
_arguments \
'--caps-remove=[capability to remove]:capability' \
'--caps-retain=[capability to retain]:capability' \
'--cpu=[cpu limit for the preceding image]:cpu limit' \
'--cpu-shares=[assign the specified CPU time share weight]:weight' \
"--environment=[set the app's environment variables]:variable key=value" \
'--exec=[override the exec command for the preceding image]:command' \
'--group=[group override for the preceding image]:group' \
'--inherit-env[inherit all environment variables not set by apps]' \
'--memory=[memory limit for the preceding image]:memory' \
'--mount=[mount point binding a volume to a path within an app]:mount point' \
'--name=[set the name of the app]:name' \
'--no-overlay[disable overlay filesystem]' \
'--oom-score-adj=[oom-score-adj isolator override]:oom-score-adj' \
'--pod-manifest=[the path to the pod manifest]:manifest:_files' \
'--port=[ports to expose on the host]:NAME\:HOSTPORT' \
'--private-users[run within user namespaces]' \
'--quiet[suppress superfluous output on stdout, print only the UUID on success]' \
'--readonly-rootfs=[mount rootfs read-only]:fs' \
'--set-env=[an environment variable to set for apps]:NAME=VALUE' \
'--set-env-file=[the path to an environment variables file]:file:_files' \
'--signature=[local signature file to use in validating the preceding image]:signature:_files' \
'--stage1-from-dir=[a filename of an image in stage1 images directory to use as stage1]:image' \
'--stage1-hash=[a hash of an image to use as stage1]:image hash' \
'--stage1-name=[a name of an image to use as stage1]:image name' \
'--stage1-path=[a path to an image to use as stage1]:image path:_files' \
'--stage1-url=[a URL to an image to use as stage1]:image url' \
'--supplementary-gids=[supplementary group IDs override for the preceding image]:group IDs' \
'--user=[user override for the preceding image]:user' \
"--user-annotation=[set the app's annotations]:annotation key=value" \
"--user-label=[set the app's labels]:label key=value" \
'--volume=[volumes to make available in the pod]:volume' \
'--working-dir=[override the working directory of the preceding image]:working directory:_files -/' \
'1:IMAGE:_rkt_images' \
;;
rm)
_arguments \
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
'1:POD:_rkt_pods' \
;;
run)
_arguments \
'--caps-remove=[capability to remove]:capability' \
'--caps-retain=[capability to retain]:capability' \
'--cpu=[cpu limit for the preceding image]:cpu limit' \
'--cpu-shares=[assign the specified CPU time share weight]:weight' \
'--dns=[name servers to write in /etc/resolv.conf]:name servers' \
'--dns-domain=[DNS domain to write in]:domain' \
'--dns-opt=[DNS options to write in /etc/resolv.conf]:dns options' \
'--dns-search=[DNS search domains to write in /etc/resolv.conf]:search domains' \
"--environment=[set the app's environment variables]:variable key=value" \
'--exec=[override the exec command for the preceding image]:command' \
'--group=[group override for the preceding image]:group' \
"--hostname=[pod's hostname]:hostname" \
"--hosts-entry=[entries to add to the pod-wide /etc/hosts. Pass 'host' to use the host's /etc/hosts]:hosts entry" \
'--inherit-env[inherit all environment variables not set by apps]' \
'--interactive[run pod interactively]' \
'--mds-register[register pod with metadata service]' \
'--memory=[memory limit for the preceding image]:memory limit' \
'--mount=[mount point binding a volume to a path within an app]:mount point' \
'--name=[set the name of the app]:name' \
"--net=[configure the pod's networking]:networks" \
'--no-overlay[disable overlay filesystem]' \
'--pod-manifest=[the path to the pod manifest]:manifest:_files' \
'--port=[ports to expose on the host]:NAME\:HOSTPORT' \
'--private-users[run within user namespaces]' \
'--set-env=[an environment variable to set for apps]:NAME=VALUE' \
'--set-env-file=[the path to an environment variables file]:file:_files' \
'--signature=[local signature file to use in validating the preceding image]:signature:_files' \
'--stage1-from-dir=[a filename of an image in stage1 images directory to use as stage1]:image' \
'--stage1-hash=[a hash of an image to use as stage1]:image hash' \
'--stage1-name=[a name of an image to use as stage1]:image name' \
'--stage1-path=[a path to an image to use as stage1]:image path:_files' \
'--stage1-url=[a URL to an image to use as stage1]:image url' \
'--supplementary-gids=[supplementary group IDs override for the preceding image]:group IDs' \
'--user=[user override for the preceding image]:user' \
"--user-annotation=[set the app's annotations]:annotation key=value" \
"--user-label=[set the app's labels]:label key=value" \
'--uuid-file-save=[write out pod UUID to specified file]:uuid file:_files' \
'--volume=[volumes to make available in the pod]:volume' \
'--working-dir=[override the working directory of the preceding image]:working directory:_files -/' \
'1:IMAGE:_rkt_images' \
;;
run-prepared)
_arguments \
'--dns=[name servers to write in /etc/resolv.conf]:name servers' \
'--dns-domain=[DNS domain to write in]:domain' \
'--dns-opt=[DNS options to write in /etc/resolv.conf]:dns options' \
'--dns-search=[DNS search domains to write in /etc/resolv.conf]:search domains' \
"--hostname=[pod's hostname]:hostname" \
"--hosts-entry=[entries to add to the pod-wide /etc/hosts. Pass 'host' to use the host's /etc/hosts]:hosts entry" \
'--interactive[run pod interactively]' \
'--mds-register[register pod with metadata service]' \
"--net=[configure the pod's networking]:networks" \
'1:POD:_rkt_pods' \
;;
status)
_arguments \
'--format=[choose the output format]:format:(json json-pretty)' \
'--wait[toggles waiting for the pod to exit]' \
'--wait-ready[toggles waiting until the pod is ready]' \
'1:POD:_rkt_pods' \
;;
stop)
_arguments \
'--force[forced stopping]' \
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
'1:POD:_rkt_pods' \
;;
trust)
_arguments \
'--insecure-allow-http[allow HTTP use for key discovery and/or retrieval]' \
'--prefix=[prefix to limit trust to]:prefix' \
'--root[add root key from filesystem without a prefix]' \
'--skip-fingerprint-review[accept key without fingerprint confirmation]' \
;;
esac
;;
esac
case $state in
rkt_help_args)
case $words[1] in
image)
_arguments \
'1: :_rkt_image_cmds'
;;
esac
;;
rkt_image_args)
case $words[1] in
cat-manifest)
_arguments \
'--pretty-print[apply indent to format the output]' \
'1:IMAGE:_rkt_images' \
;;
export)
_arguments \
'--overwrite[overwrite output ACI]' \
'1:IMAGE:_rkt_images' \
'2:OUTPUT_ACI_FILE:_files' \
;;
extract|render)
_arguments \
'--overwrite[overwrite output ACI]' \
'--rootfs-only[extract rootfs only]' \
'1:IMAGE:_rkt_images' \
'2:OUTPUT_DIR:_files -/' \
;;
gc)
_arguments \
'--grace-period=[duration to wait before discarding inactive pods from garbage]:duration' \
;;
list)
_arguments \
'--fields=[comma-separated list of fields to display]:fields:{_values -s , id name importtime lastused size latest}' \
'--full[use long output format]' \
'--no-legend[suppress a legend with the list]' \
;;
rm)
_arguments \
'*:IMAGE:_rkt_images' \
;;
esac
;;
esac
}
_rkt_cmds() {
local -a commands
commands=(
'api-service:Run API service'
'cat-manifest:Inspect and print the pod manifest'
'config:Print configuration for each stage in JSON format'
'enter:Enter the namespaces of an app within a rkt pod'
'export:Export an app from an exited pod to an ACI file'
'fetch:Fetch image(s) and store them in the local store'
'gc:Garbage collect rkt pods no longer in use'
'image:Operate on image(s) in the local store'
'list:List pods'
'metadata-service:Run metadata service'
'prepare:Prepare to run image(s) in a pod in rkt'
'rm:Remove all files and resources associated with an exited pod'
'run:Run image(s) in a pod in rkt'
'run-prepared:Run a prepared application pod in rkt'
'status:Check the status of a rkt pod'
'stop:Stop a pod'
'trust:Trust a key for image verification'
'version:Print the version and exit'
'help:Help about any command'
)
_describe 'command' commands
}
_rkt_image_cmds() {
local -a commands
commands=(
'cat-manifest:Inspect and print the image manifest'
'export:Export a stored image to an ACI file'
'extract:Extract a stored image to a directory'
'gc:Garbage collect local store'
'list:List images in the local store'
'render:Render a stored image to a directory with all its dependencies'
'rm:Remove image(s) with the given ID(s) or name(s) from the local store'
)
_describe 'command' commands
}
_rkt_images() {
local -a images
images=($(rkt image list --fields id,name --no-legend | sed 's/\t/\n/;s/:/\\:/g' | sort | uniq))
_describe 'IMAGE' images
}
_rkt_pods() {
local -a pods
IFS=$'\n'
pods=($(rkt list --full --no-legend | sed 's/:/\\:/g;s/\t/:/;s/\t/ /g'))
_describe 'POD' pods
}
_rkt "$@"
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,88 +0,0 @@
#compdef rsvm
# ------------------------------------------------------------------------------
# Copyright (c) 2016 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for rsvm (https://github.com/sdepold/rsvm).
# Adapted from Docker Machine completion by hhatto (https://github.com/ilkka)
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * michaelmior (https://github.com/michaelmior)
#
# ------------------------------------------------------------------------------
# helper function for completing available rusts
__rusts() {
declare -a rusts_cmd
rusts_cmd=($(ls "$HOME/.rsvm/versions"))
_describe 'rusts' rusts_cmd
}
# subcommands
local -a _rsvm_cmds
_rsvm_cmds=(
'help:Show a help message' \
'install:Download and install a version' \
'uninstall:Uninstall a version' \
'use:Activate a version for now and the future' \
'ls:List all installed versions of rust' \
'ls-remote:List remote versions available for install' \
'ls-channel:Print a channel version available for install' \
)
# subcommand completion functions
__uninstall() {
__rusts
}
__use() {
__rusts
}
# common args
_arguments \
'--help[show help]' \
'--version[print the version]' \
'*:: :->command'
# start rusts!
if (( CURRENT == 1 )); then
_describe -t commands 'rsvm command' _rsvm_cmds
fi
local -a _command_args
case "$words[1]" in
uninstall)
__uninstall ;;
use)
__use ;;
esac