File: _jails

package info (click to toggle)
zsh 5.9-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,856 kB
  • sloc: ansic: 108,138; sh: 6,976; makefile: 722; perl: 687; awk: 291; sed: 16
file content (33 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#autoload

# Options:
#
# -0        include jid 0 as a match for the host system
# -o param  jail parameter to complete instead of jid -
#              e.g. name, path, ip4.addr, host.hostname

local addhost host param desc=1
local -a jails args expl
zparseopts -D -K -E 0=addhost o:=param
param=${param[2]:-name}

jails=( ${${(f)"$(_call_program jails jls $param name)"}/ /:} )
case $param in
  jid) host=0 ;;
  name)
    host=0
    desc=0
  ;;
  path)
    host=/
    args=( -M 'r:|/=* r:|=*' )
  ;;
  ip4.addr) args=( -M 'r:|.=* r:|=*' ) ;;
esac
[[ -n $addhost && -n $host ]] && jails+=( "$host:$HOST" )

if (( desc )); then
  _describe -t jails jail jails "$@" "$args[@]"
else
  _wanted jails expl jail compadd "$@" "$args[@]" - ${jails%:*}
fi