blob: 6e498bee36fd9fc8d3638694176c00d6b024fb3c (
plain) (
blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#compdef beadm
_beadm() {
local context state line subcmds
typeset -A opt_args
subcmds=( activate create destroy list mount rename unmount )
if [[ $service == "beadm" ]]; then
_arguments -C -A "-*" \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
_wanted commands expl 'beadm subcommand' compadd -a subcmds
return
fi
service="$words[1]"
curcontext="${curcontext%:*}=$service:"
fi
case $service in
(activate)
_arguments -A "-*" \
':BE name:_be_name'
;;
(create)
# TODO: Add support for -o, and for creating snapshots
_arguments -A "-*" \
'-a[Activate new BE]' \
'-d[Description]:' \
'-e[Base BE]:BE name or snapshot:_be_name -t all' \
'-p[Create new BE in specified ZFS pool]:ZFS pool:_zfs_pool' \
':new BE name:'
;;
(destroy)
_arguments -A "-*" \
'-f[Unmount BE if necessary]' \
"-F[Don't prompt for verification]" \
':BE or BE snapshot:_be_name'
;;
(list)
_arguments -A "-*" \
'-a[List subordinate filesystems and snapshots]' \
'-d[List subordinate filesystems]' \
'-s[List snapshots]' \
'-H[Parseable format]' \
':BE name:_be_name'
;;
(mount)
_arguments -A "-*" \
':BE name:_be_name' \
':mountpoint:_path_files -/'
;;
(rename)
_arguments -A "-*" \
':existing BE name:_be_name' \
':new BE name:'
;;
(unmount)
_arguments -A "-*" \
'-f[Force unmount]' \
':BE name:_be_name'
;;
(*)
_message "unknown beadm subcommand: $service"
esac
}
_beadm "$@"
|