From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8542 invoked by alias); 7 May 2015 02:49:56 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35052 Received: (qmail 13754 invoked from network); 7 May 2015 02:49:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Eric Cook To: zsh-workers@zsh.org Subject: [PATCH] Completion for freebsd's bsdconfig(8), bsdinstall(8), jls(8) and jexec(8) Date: Wed, 6 May 2015 22:36:48 -0400 Message-Id: <1430966208-10605-1-git-send-email-llua@gmx.com> X-Mailer: git-send-email 2.3.7 X-Provags-ID: V03:K0:xghS6vXpCwGwZOlCtAsAck7/7e+E0xBv7jncPRpFR3DRph5sSjb UqVoP8zjzsYB1O6fxrqOwFkX3vkEhbUEtuncel+qvc2jB/HZU8Vw1FDnSK6Z+IiMeYXZlU0 bxNrb7H9wvGwi+4dnw0/vQFUXXTLnK/OK8Rz//ueWRE8piiKPj8GI+btTW9bnD1Ohlt5P0B eXVN/hDBu+bEs7kK62wLQ== X-UI-Out-Filterresults: notjunk:1; Adding a few completers i've had for awhile. --- Completion/BSD/Command/_bsdconfig | 55 ++++++++++++++++++++++++++++++++++++++ Completion/BSD/Command/_bsdinstall | 46 +++++++++++++++++++++++++++++++ Completion/BSD/Command/_jexec | 19 +++++++++++++ Completion/BSD/Command/_jls | 19 +++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 Completion/BSD/Command/_bsdconfig create mode 100644 Completion/BSD/Command/_bsdinstall create mode 100644 Completion/BSD/Command/_jexec create mode 100644 Completion/BSD/Command/_jls diff --git a/Completion/BSD/Command/_bsdconfig b/Completion/BSD/Command/_bsdconfig new file mode 100644 index 0000000..8c7597e --- /dev/null +++ b/Completion/BSD/Command/_bsdconfig @@ -0,0 +1,55 @@ +#compdef bsdconfig + +local -a shortcuts +shortcuts=( + 'console:utilities to customize the behavior of the system console' + 'defaultrouter:default router/gateway' + 'diskmgmt:manage disk partitions and/or labels using sade(8)' + 'docsinstall:install/reinstall FreeBSD documentation set(s)' + 'dot:generate a graphviz dot(1) language file(printed on stdout)' + 'groupadd:add groups' + 'groupdel:delete groups' + 'groupedit:edit/view groups' + 'groupmgmt:utilities to add/change/view/delete group accounts' + 'hostname:set hostname/domainname' + 'kern_securelevel:set kern.securelevel variable' + 'mouse:utilities for configuring, exploring, and enabling console mouse support' + 'mouse_disable:disable mouse support' + 'mouse_enable:enable mouse support' + 'mouse_flags:set mouse daemon flags' + 'mouse_port:select mouse port' + 'mouse_type:select mouse type' + 'nameservers:DNS Nameservers menu under networking' + 'netdev:configure network interfaces' + 'networking:utilities for network related settings' + 'packages:browse, install, uninstall, or re-install packaged software' + 'password:set the system administrator (root) password' + 'security:configure various system security settings' + 'startup:configure various aspects of system startup' + 'startup_misc:miscellaneous startup services' + 'startup_rcadd:add directives to rc.conf(5)' + 'startup_rcconf:view/edit directives to rc.conf(5)' + 'startup_rcdelete:delete directives from rc.conf(5)' + 'startup_rcvar:toggle directives on/off' + 'syscons_font:select console font' + 'syscons_keymap:select console keymap' + 'syscons_repeat:set key repeat speed' + 'syscons_saver:select console screensaver' + 'syscons_screenmap:select console screenmap' + 'syscons_ttys:select console TTY type' + 'timezone:set the regional timezone of the local machine' + 'ttys:edit the ttys(5) database with your favorite editor' + 'useradd:add users' + 'userdel:delete users' + 'useredit:edit/view users' + 'usermgmt:utilities to add/edit/view/delete user accounts' +) + +_arguments -s -w -A '-*' : \ + '-d[debug mode]' \ + '-D[send debug info to file]: :{ compset -P 1 +; _files }' \ + '-f[load file as script then exit]: : _files' \ + '-h[print usage then exit]' \ + '-S[secure X11 mode]' \ + '-X[use Xdialog(1)]' \ + '1:bsdconfig(8) menus:(( $shortcuts ))' diff --git a/Completion/BSD/Command/_bsdinstall b/Completion/BSD/Command/_bsdinstall new file mode 100644 index 0000000..e0589d7 --- /dev/null +++ b/Completion/BSD/Command/_bsdinstall @@ -0,0 +1,46 @@ +#compdef bsdinstall + +local -a _bsdinstall_targets +_bsdinstall_targets=( + 'auto:standard interactive installation, including disk partitioning' + "entropy:stores a small amount of data from /dev/random in the new system's root" + 'jail:sets up a new chroot system at destination, suitable for use with jail(8)' + 'script:run an installation script' + "keymap:set the keymap and save to the new system's rc.conf" + 'hostname:set the hostname for the new system' + 'netconfig:configure networking' + 'autopart:run the interactive guided disk partitioner' + 'zfsboot:run the interactive/scriptable ZFS partitioner' + 'scriptedpart:non-interactive partition setup' + 'mount:mount the file systems previously configured by autopart, partedit, or scriptedpart' + 'distfetch:fetches the distributions in DISTRIBUTIONS to BSDINSTALL_DISTDIR from BSDINSTALL_DISTSITE' + 'checksum:verifies the checksums of the distributions listed in DISTRIBUTIONS' + 'distextract:extracts the distributions listed in DISTRIBUTIONS into BSDINSTALL_CHROOT' + "rootpass:interactively invokes passwd(1) in the new system to set the root user's password" + 'adduser:interactively invokes adduser(8) in the new system' + 'time:interactively sets the time, date, and time zone of the new system' + 'services:queries the user for the system daemons to begin at system startup' + 'config:installs the configuration files destined for the new system' +) + +local context state state_descr line +typeset -A val_args +_arguments -A '-*' : \ + '-D[installation log file]: : _files' \ + '1: :->targets' \ + '*: :->args' + +case $state in + targets) _describe targets _bsdinstall_targets;; + args) + shift words + [[ $words[1] == '-D' ]] && shift 2 words + + case $words[1] in + jail) _files -/;; + script) _files;; + scriptedpart) _message "$words[1] parameters";; + *) _message "nothing to complete"; return 1;; + esac + ;; +esac diff --git a/Completion/BSD/Command/_jexec b/Completion/BSD/Command/_jexec new file mode 100644 index 0000000..f065ea1 --- /dev/null +++ b/Completion/BSD/Command/_jexec @@ -0,0 +1,19 @@ +#compdef jexec + +_jexec_normal() { + local PATH=$PATH + # relative paths are relative to the jail's root + path=( "$(command jls -j $words[1] path)"/$^path ) + shift 1 words; (( CURRENT-- )) + _normal +} + +_jexec() { + _arguments -s -w -A "-*" : \ + '(-U)-u[host environment user whom command runs as]:host user:_users' \ + '(-u)-U[jail environment user whom command runs as]:jail user:_users' \ + '1:jail:_jails' \ + '*:: : _jexec_normal' +} + +_jexec "$@" diff --git a/Completion/BSD/Command/_jls b/Completion/BSD/Command/_jls new file mode 100644 index 0000000..a6f8a7e --- /dev/null +++ b/Completion/BSD/Command/_jls @@ -0,0 +1,19 @@ +#compdef jls + +local curcontext=$curcontext state state_descr line +typeset -A opt_args + +_arguments -C -s -w -A '-*' : \ + '-d[include diying jails]' \ + '-h[print header line]' \ + "-N[print jail's name instead of numeric ID]" \ + '-n[print parameters in ``name=value'\'\'' format]' \ + '-q[quote parameter value when it contains whitespace, quotes or empty string]' \ + '-s[print parameters suitable for passing to jail(8)]' \ + '-v[print a multiple-line summary per jail]' \ + '-j[the jid or name of the jail to list]:jail:_jails' \ + '*: :->parameters' + +if [[ $state == parameters ]]; then + _values -w -S ' ' 'jail parameter' ${${${(f)"$(sysctl -N security.jail.param)"}%.#}##security.jail.param.#} +fi -- 2.3.7