35052: new BSD completions

This commit is contained in:
Eric Cook 2015-05-06 22:36:48 -04:00 committed by Peter Stephenson
parent aa34d2f165
commit 13c6d38e4b
5 changed files with 146 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2015-05-07 Peter Stephenson <p.stephenson@samsung.com>
* Eric Cook: 35052: Completion/BSD/Command/_bsdconfig,
Completion/BSD/Command/_bsdinstall,
Completion/BSD/Command/_jexec, Completion/BSD/Command/_jls:
new completions.
2015-05-06 Barton E. Schaefer <schaefer@zsh.org>
* 35046: Src/lex.c: properly unwind cmdstack when erroring out of

View file

@ -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 ))'

View file

@ -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

View file

@ -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 "$@"

View file

@ -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