forked from OpenIndiana/openindiana-completions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootadm
96 lines (88 loc) · 2.98 KB
/
bootadm
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# OpenIndiana bootadm(1M) completion -*- shell-script -*-
# ------------------------------------------------------------------------------
# Copyright (c) 2013, Pashev Igor <[email protected]>
# Copyright (c) 2018, Michal Nowak <[email protected]>
_bootadm() {
local cur prev opts line
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev="${COMP_WORDS[COMP_CWORD-1]}"
line="${COMP_LINE}"
if [[ ${COMP_CWORD} -eq 1 ]]; then
COMPREPLY=( $(compgen -W "update-archive list-archive install-bootloader set-menu list-menu" -- $cur) )
return
fi
case "$prev" in
-R)
_cd
return;;
-p)
COMPREPLY=( $(compgen -W "i86pc sun4v sun4u" -- $cur) )
return;;
-F)
COMPREPLY=( $(compgen -W "cpio hsfs ufs ufs-nocompress" -- $cur) )
return;;
-P)
COMPREPLY=( $(compgen -W "$(zpool list -H -o name)" -- "${cur}") )
return;;
esac
case "$line" in
*update-archive*-R*)
# update-archive [-vnf] [-R altroot [-p platform]] [-F format ]
COMPREPLY=( $(compgen -W "-v -n -f -p -F" -- $cur) )
;;
*update-archive*)
# update-archive [-vnf] [-R altroot [-p platform]] [-F format ]
COMPREPLY=( $(compgen -W "-v -n -f -R -F" -- $cur) )
;;
*list-archive*-p*-R*)
# list-archive [-vn] [-R altroot [-p platform]]
;& # fallthru
*list-archive*-R*-p*)
# list-archive [-vn] [-R altroot [-p platform]]
COMPREPLY=( $(compgen -W "-v -n" -- $cur) )
;;
*list-archive*-R*)
# list-archive [-vn] [-R altroot [-p platform]]
COMPREPLY=( $(compgen -W "-v -n -p" -- $cur) )
;;
*list-archive*)
# list-archive [-vn] [-R altroot [-p platform]]
COMPREPLY=( $(compgen -W "-v -n -R" -- $cur) )
;;
*install-bootloader*)
# install-bootloader [-Mfv] [-R altroot] [-P pool]
COMPREPLY=( $(compgen -W "-M -f -v -R -P" -- $cur) )
;;
*set-menu*-R*)
# set-menu [-R altroot] key=value
COMPREPLY=( $(compgen -W "default= timeout=" -- $cur) )
compopt -o nospace
;;
*set-menu*)
# set-menu [-R altroot] key=value
COMPREPLY=( $(compgen -W "-R default= timeout=" -- $cur) )
if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != -R ]]; then
compopt -o nospace
fi
;;
*list-menu*-o*)
# list-menu [-R altroot] [-o key=value]
COMPREPLY=( $(compgen -W "entry= title=" -- $cur) )
if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != -R ]]; then
compopt -o nospace
fi
;;
*list-menu*-R*)
# list-menu [-R altroot] [-o key=value]
COMPREPLY=( $(compgen -W "-o" -- $cur) )
;;
*list-menu*)
# list-menu [-R altroot] [-o key=value]
COMPREPLY=( $(compgen -W "-R -o" -- $cur) )
;;
esac
}
complete -F _bootadm bootadm
# ex: filetype=sh
# vim: tabstop=2 shiftwidth=2 expandtab smartindent