Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion for freebsd's bsdconfig(8), bsdinstall(8), jls(8) and jexec(8)
- X-seq: zsh-workers 35052
- From: Eric Cook <llua@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Completion for freebsd's bsdconfig(8), bsdinstall(8), jls(8) and jexec(8)
- Date: Wed, 6 May 2015 22:36:48 -0400
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author