View | Details | Raw Unified | Return to bug 126457
Collapse All | Expand All

(-)./Completion/BSD/Command/_csup (-10 / +10 lines)
Lines 4-20 Link Here
4
    '-1[disable automatic retries]' \
4
    '-1[disable automatic retries]' \
5
    '-4[Force usage of IPv4 addresses]' \
5
    '-4[Force usage of IPv4 addresses]' \
6
    '-6[Force usage of IPv6 addresses]' \
6
    '-6[Force usage of IPv6 addresses]' \
7
    '-A:local address:_hosts' \
7
    '-A[Local address to bind to when connecting to the server]:local address:_hosts' \
8
    '-b:base directory:_files -/' \
8
    '-b[Base directory]:base directory:_files -/' \
9
    '-c:collections directory:_files -/' \
9
    '-c[Subdirectory of base for information about collections]:collections directory:_files -/' \
10
    '-d:maximum number of deleted files:' \
10
    '-d[maximum number of deleted files]:maximum number of deleted files:' \
11
    '-h:server host:_hosts' \
11
    '-h[Server host]:server host:_hosts' \
12
    '-i:file pattern:' \
12
    '-i[Include only files and directories matching]:file pattern:' \
13
    '-k[keep temporary copies of failed updates]' \
13
    '-k[keep temporary copies of failed updates]' \
14
    '-l:lock file:_files' \
14
    '-l[Lock file]:lock file:_files' \
15
    '-L:verbosity level:(0 1 2)' \
15
    '-L[Verbosity level]:verbosity level:(0 1 2)' \
16
    '-p:port:_ports' \
16
    '-p[Server port]:port:_ports' \
17
    '-r:maximum number of retries:' \
17
    '-r[maximum number of retries]:maximum number of retries:' \
18
    '-s[suppress status checks]' \
18
    '-s[suppress status checks]' \
19
    '-v[print version information]' \
19
    '-v[print version information]' \
20
    '(-Z)-z[enable compression]' \
20
    '(-Z)-z[enable compression]' \
(-)./Completion/BSD/Command/_fetch (+30 lines)
Line 0 Link Here
1
#compdef fetch
2
# Deprecated arguments are removed from the completion
3
4
_arguments -s \
5
	'-1[Stop and return exit code 0 at the first successfully retrieved file]' \
6
	'-4[Forces fetch to use IPv4 addresses only]' \
7
	'-6[Forces fetch to use IPv6 addresses only]' \
8
	'-A[Do not automatically follow "temporary" (302) redirects]' \
9
	'-a[Automatically retry the transfer upon soft failures]' \
10
	'-B[Specify the read buffer size in bytes]:bytes:' \
11
	'-d[Use a direct connection even if a proxy is configured]' \
12
	'-F[In combination with the -r flag, forces a restart]' \
13
	'-l[If the target is a file-scheme URL, make a symbolic link to the target]' \
14
	'-M' \
15
	'-m[Mirror mode]' \
16
	'-N[Use file instead of ~/.netrc to look up login names and pass- words for FTP sites]' \
17
	'-n[Do not preserve the modification time]' \
18
	'-o[Set the output file name]:file:_files' \
19
	'-P' \
20
	'-p[Use passive FTP]' \
21
	'-q[Quiet mode]' \
22
	'-R[Do not delete the output file in any circumstances]' \
23
	'-r[Restart a previously interrupted transfer]' \
24
	'-S[Require the file size reported by the server to match the specified value]' \
25
	'-s[Print the size in bytes, without fetching it]' \
26
	'-T[Set timeout value]:seconds:' \
27
	'-U[When using passive FTP, allocate the port for the data connection from the low port range]' \
28
	'-v[Increase verbosity level]' \
29
	'-w[wait successive retries]:seconds:' \
30
	'*:URL to fetch:_urls'
(-)./Completion/BSD/Command/_freebsd-update (+20 lines)
Line 0 Link Here
1
#compdef freebsd-update
2
3
local flags
4
flags=(
5
  '(cron)fetch[Fetch a compressed snapshot or update existing one]'
6
  '(fetch)cron[Sleep rand(3600) seconds, and then fetch updates]'
7
  '(install rollback)upgrade[Fetch files necessary for upgrading to a new release]'
8
  '(upgrade rollback)install[Install the most recently fetched updates or upgrade]'
9
  '(upgrade install)rollback[Uninstall the most recently installed updates]'
10
)
11
12
_arguments -s \
13
  '-b[Operate on a system mounted at basedir]:basedir:_files -/' \
14
  '-d[Store working files in workdir]:workdir:_files -/' \
15
  '-f[Read configuration options from conffile]:conf file:_files' \
16
  '-k[Trust an RSA key with SHA256 of KEY]:RSA key:' \
17
  '-r[Specify the new release]:new release:' \
18
  '-s[Fetch files from the specified server or server pool]:server:_hosts' \
19
  '-f[Mail output of cron command, if any, to address]:address:' \
20
  ':command:_values -S " " -w "commands" $flags[@]'
(-)./Completion/BSD/Command/_portlint (-2 / +2 lines)
Lines 12-17 Link Here
12
    '-t[nit pick about use of spaces]' \
12
    '-t[nit pick about use of spaces]' \
13
    '-N[writing a new port]' \
13
    '-N[writing a new port]' \
14
    '-V[print the version and exit]' \
14
    '-V[print the version and exit]' \
15
    '-M:set make variables to ENV (ex. PORTSDIR=/usr/ports.work):_guard ".#" "environment vars"' \
15
    '-M[set make variables to ENV (ex. PORTSDIR=/usr/ports.work)]: :_guard ".#" "environment vars"' \
16
    '-B:allow # contiguous blank lines:_guard "[0-9]#" "numeric value"' \
16
    '-B[allow # contiguous blank lines]: :_guard "[0-9]#" "numeric value"' \
17
    ':port directory:_files -/'
17
    ':port directory:_files -/'
(-)./Completion/BSD/Command/_portsnap (-6 / +6 lines)
Lines 11-23 Link Here
11
)
11
)
12
12
13
_arguments -C -s \
13
_arguments -C -s \
14
    '-d:Store working files in workdir:_files -/' \
14
    '-d[Store working files in workdir]:workdir:_files -/' \
15
    '-f:Read configuration options from conffile:_files' \
15
    '-f[Read configuration options from conffile]:conf file:_files' \
16
    '-I[Update INDEX only. (update command only)]' \
16
    '-I[Update INDEX only. (update command only)]' \
17
    '-k:Trust an RSA key with SHA256 hash of KEY:_files' \
17
    '-k[Trust an RSA key with SHA256 hash of KEY]:RSA key:_files' \
18
    '-l:Merge the specified local describes file into the INDEX:_files' \
18
    '-l[Merge the specified local describes file into the INDEX]:file:_files' \
19
    '-p:Location of uncompressed ports tree:_files -/' \
19
    '-p[Location of uncompressed ports tree]:uncompressed ports tree:_files -/' \
20
    '-s:Server from which to fetch updates:_hosts' \
20
    '-s[Server from which to fetch updates]:server:_hosts' \
21
    '*:principal:->principal' && ret=0
21
    '*:principal:->principal' && ret=0
22
22
23
if [[ $state == principal ]]; then
23
if [[ $state == principal ]]; then
(-)./Completion/BSD/Command/_powerd (+13 lines)
Line 0 Link Here
1
#compdef powerd
2
3
local powerd_mode
4
powerd_mode=(minimum maximum adaptative)
5
_arguments -s \
6
    "-a[Mode to use while on AC power]:mode:($powerd_mode)" \
7
    "-b[Mode to use while on battery power]:mode:($powerd_mode)" \
8
    '-i[CPU idle percent level when begin to degrade performance]:percent:' \
9
    "-n[mode to use normally when the AC line state is unknown]:mode:($powerd_mode)" \
10
    '-p[polling interval (in milliseconds) for AC line state and system idle levels]:interval:' \
11
    '-P[Alternative pidfile]:pidfile:_files' \
12
    '-r[CPU idle percent level where to increase performance]:percent:' \
13
    '-v[Verbose mode]'
(-)./Completion/Unix/Command/_zfs (+238 lines)
Line 0 Link Here
1
#compdef zfs
2
3
_zfs() {
4
	local context state line expl
5
	typeset -A opt_args
6
	local -a subcmds rw_properties rw_propnames ro_properties
7
8
	subcmds=(
9
		"create" "destroy" "clone" "promote" "rename" "snapshot"
10
		"rollback" "list" "set" "get" "inherit" "mount" "unmount"
11
		"share" "unshare" "send" "receive" "allow" "unallow"
12
		"upgrade"
13
	)
14
15
	ro_properties=(
16
		"name" "type" "creation" "used" "available" "referenced"
17
		"compressratio" "mounted" "origin"
18
	)
19
20
	# TODO: Be cleverer about what values can be set.  Is there any way to
21
	# set the sorting for *size properties to false by default?
22
	rw_properties=(
23
		"aclinherit:value:(discard noallow secure passthrough)"
24
		"aclmode:value:(discard groupmask passthrough)"
25
		"atime:value:(on off)"
26
		"canmount:value:(on off)"
27
		"checksum:value:(on off fletcher2 fletcher4 sha256)"
28
		"compression:value:(on off lzjb gzip gzip-{1..9})"
29
		"copies:value:(1 2 3)"
30
		"devices:value:(on off)"
31
		"exec:value:(on off)"
32
		"mountpoint:value:{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
33
		"quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
34
		"readonly:value:(on off)"
35
		"recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)"
36
		"reservation:value:" # <size>, "none"
37
		"setuid:value:(on off)"
38
		"shareiscsi:value:(on off)" # or "type=<type>"
39
		"sharenfs:value:(on off)" # or share(1M) options
40
		"snapdir:value:(hidden visible)"
41
		"version:value:(1 2 current)"
42
		"volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K)"
43
		"volsize:value:" # <size>
44
		"xattr:value:(on off)"
45
		"zoned:value:(on off)"
46
	)
47
48
	rw_propnames=( ${rw_properties%%:*} )
49
50
	if [[ $service == "zfs" ]]; then
51
		_arguments -C -A "-*" \
52
			'-\?[Help]' \
53
			'*::command:->subcmd' && return 0
54
55
		if (( CURRENT == 1 )); then
56
			_wanted commands expl "zfs subcommand" compadd -a subcmds
57
			return
58
		fi
59
		service="$words[1]"
60
		curcontext="${curcontext%:*}=$service:"
61
	fi
62
63
	case $service in
64
	("create")
65
		_arguments -A "-*" \
66
			'-p[Create parent datasets]' \
67
			'-o[Set initial properties]:property:_values -s , "property" $rw_properties' \
68
			- set1 \
69
			':filesystem:' \
70
			- set2 \
71
			'-s[Create sparse volume]' \
72
			'-b[Set volblocksize]:blocksize:' \
73
			'-V[Set size]:size:' \
74
			':volume:'
75
		;;
76
77
	("destroy")
78
		_arguments -A "-*" \
79
			'-r[Recursively destroy all children]' \
80
			'-R[Recursively destroy all dependents]' \
81
			'-f[Force unmounts]' \
82
			':filesystem/volume/snapshot:_zfs_dataset'
83
		;;
84
85
	("snapshot")
86
		_arguments -A "-*" \
87
			'-r[Recursively snapshot all descendant datasets]' \
88
			':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
89
		;;
90
91
	("rollback")
92
		_arguments -A "-*" \
93
			'-r[Recursively destroy more recent snapshots]' \
94
			'-R[Recursively destroy more recent snapshots and clones]' \
95
			'-f[Force unmounts]' \
96
			':snapshot:_zfs_dataset -t snap'
97
		;;
98
99
	("clone")
100
		_arguments -A "-*" \
101
			'-p[Create parent datasets]' \
102
			# XXX needs to bail if there are no snapshots
103
			':snapshot:_zfs_dataset -t snap' \
104
			':filesystem/volume:'
105
		;;
106
107
	("promote")
108
		# XXX complete only cloned filesystems
109
		_arguments \
110
			':filesystem:_zfs_dataset -t fs' \
111
		;;
112
113
	("rename")
114
		_arguments -A "-*" \
115
			- set1 \
116
			'-p[Create parent datasets]' \
117
			':filesystem/volume/snapshot:_zfs_dataset' \
118
			':filesystem/volume/snapshot:' \
119
			- set2 \
120
			'-r[Recursively rename snapshots of all descendent datasets]' \
121
			':snapshot:_zfs_dataset -t snap' \
122
			':snapshot:'
123
		;;
124
125
	("list")
126
		_arguments -A "-*" \
127
			'-r[Recursively display children]' \
128
			'-H[Scripting mode]' \
129
			'-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
130
			'*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
131
			'*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
132
			'-t[Dataset types to list]:dataset type:_values -s , "dataset type" filesystem snapshot volume' \
133
			'*:filesystem/volume/snapshot:_zfs_dataset'
134
		;;
135
136
	("set")
137
		_arguments \
138
			':property:_values -s , "property" $rw_properties' \
139
			'*:filesystem/volume:_zfs_dataset -t fs -t vol'
140
		;;
141
142
	("get")
143
		_arguments -A "-*" \
144
			"-r[Recursively display children's properties]" \
145
			'-H[Scripting mode]' \
146
			'-p[Display numbers exactly]' \
147
			'-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \
148
			'-o[Specify fields]:field:_values -s , "field" name property value source' \
149
			':property:_values -s , "property" $ro_properties $rw_propnames all' \
150
			'*:filesystem/volume/snapshot:_zfs_dataset'
151
		;;
152
153
	("inherit")
154
		_arguments -A "-*" \
155
			'-r[Recursively inherit property for all children]' \
156
			':property:_values -s , "property" $ro_properties $rw_properties' \
157
			'*:filesystem/volume:_zfs_dataset -t fs -t vol'
158
		;;
159
160
	("mount")
161
		_arguments -A "-*" \
162
			'-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
163
			'-O[Overlay mount]' \
164
			'-v[Report mount progress]' \
165
			- set1 \
166
			':filesystem:_zfs_dataset -t fs' \
167
			- set2 \
168
			'-a[Mount all available ZFS filesystems]'
169
		;;
170
171
	("unmount")
172
		_arguments -A "-*" \
173
			- set1 \
174
			'-f[Force unmount]' \
175
			':filesystem:_zfs_dataset -t fs -t mtpt' \
176
			- set2 \
177
			'-a[Unmount all ZFS filesystems]'
178
		;;
179
180
	("share")
181
		_arguments -A "-*" \
182
			- set1 \
183
			'-a[Share all available ZFS filesystems]' \
184
			- set2 \
185
			':filesystem:_zfs_dataset -t fs'
186
		;;
187
188
	("unshare")
189
		_arguments -A "-*" \
190
			- set1 \
191
			'-a[Unshare all shared ZFS filesystems]' \
192
			- set2 \
193
			'-F[Force unshare]' \
194
			':filesystem:_zfs_dataset -t fs -t mtpt'
195
		;;
196
197
	("send")
198
		_arguments -A "-*" \
199
			'-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
200
			':snapshot:_zfs_dataset -t snap'
201
		;;
202
203
	("receive")
204
		_arguments -A "-*" \
205
			'-v[Verbose]' \
206
			'-n[Do not receive the stream]' \
207
			'-F[Force a rollback if necessary]' \
208
			- set1 \
209
			':filesystem/volume/snapshot:_zfs_dataset' \
210
			- set2 \
211
			'-d[Set path prefix]:filesystem:_zfs_dataset -t fs'
212
		;;
213
214
	("allow"|"unallow")
215
		_message "unimplemented zfs subcommand: $service"
216
		;;
217
218
	("upgrade")
219
		_arguments -A "-*" \
220
			- set1 \
221
			'-v[Verbose]' \
222
			- set2 \
223
			'-a[Upgrade all filesystems on all pools]' \
224
			'-r[Upgrade descendent filesystems, too]' \
225
			'-V[Upgrade to specified version]:version:(1 2)' \
226
			- set3 \
227
			'-r[Upgrade descendent filesystems, too]' \
228
			'-V[Upgrade to specified version]:version:(1 2)' \
229
			':filesystem:_zfs_dataset -t fs' \
230
		;;
231
232
	(*)
233
		_message "unknown zfs subcommand: $service"
234
		;;
235
	esac
236
}
237
238
_zfs "$@"
(-)./Completion/Unix/Command/_zpool (+201 lines)
Line 0 Link Here
1
#compdef zpool
2
3
_zpool() {
4
	local -a subcmds fields
5
6
	subcmds=(
7
		  create destroy add remove list iostat status online
8
		  offline clear attach detach replace scrub import export 
9
		  upgrade history get set
10
	)
11
12
	fields=(
13
		name\:"Pool name" size\:"Total size" used\:"Space used"
14
		available\:"Space available" capacity\:"Space used (percentage)"
15
		health\:"Health status"
16
	)
17
18
	properties=(
19
		"bootfs:value:"
20
		"autoreplace:value:(on off)"
21
		"delegation:value:(on off)"
22
	)
23
	propnames=( ${properties%%:*} )
24
25
	import_properties=(
26
		xattr
27
		copies
28
		shareiscsi
29
		canmount
30
		share
31
		sharenfs
32
		userprop
33
		mount
34
	)
35
36
	if [[ $service == "zpool" ]]; then
37
		_arguments -C -A "-*" \
38
			'-\?[Help]' \
39
			'*::command:->subcmd' && return 0
40
41
		if (( CURRENT == 1 )); then
42
			_wanted commands expl "zpool subcommand" compadd -a subcmds
43
			return
44
		fi
45
		service="$words[1]"
46
		curcontext="${curcontext%:*}=$service:"
47
	fi
48
49
	case $service in
50
	(clear)
51
		_arguments \
52
			':pool name:_zfs_pool' \
53
			'*:virtual device:_files'
54
		;;
55
56
	(create)
57
		# TODO: investigate better vdev handling
58
		_arguments -A "-*" \
59
			'-f[Force use of in-use devices]' \
60
			'-n[Display configuration without creating pool]' \
61
			'-R[Use alternate root]:alternate root:_files -/' \
62
			'-m[Set mountpoint for root dataset]:mountpoint:' \
63
			':pool name:' \
64
			'*:virtual device:_files'
65
		;;
66
67
	(destroy)
68
		_arguments -A "-*" \
69
			'-f[Force active datasets to be unmounted]' \
70
			':pool name:_zfs_pool'
71
		;;
72
73
	(add)
74
		_arguments -A "-*" \
75
			'-f[Force use of in-use devices]' \
76
			'-n[Display configuration without modifying pool]' \
77
			':pool name:_zfs_pool' \
78
			'*:virtual device:_files'
79
		;;
80
81
	(list)
82
		_arguments \
83
			'-H[Scripted mode]' \
84
			'-o[Fields to list]:field:_values -s , "field" ${^fields/\:/[}\]' \
85
			'::pool name:_zfs_pool'
86
		;;
87
88
	(iostat)
89
		_arguments -A "-*" \
90
			'-v[Verbose statistics]' \
91
			'*::pool name:_zfs_pool' \
92
			'::interval:' \
93
			'::count:'
94
		;;
95
96
	(status)
97
		_arguments -A "-*" \
98
			'-v[Verbose information]' \
99
			'-x[Show only unhealthy pools]' \
100
			'*::pool name:_zfs_pool'
101
		;;
102
103
	(offline)
104
		_arguments -A "-*" \
105
			'-t[Offline until next reboot]' \
106
			':pool name:_zfs_pool' \
107
			'*:virtual device:_files'
108
		;;
109
110
	(online)
111
		_arguments \
112
			':pool name:_zfs_pool' \
113
			'*:virtual device:_files'
114
		;;
115
116
	(attach)
117
		# TODO: first device should choose first from existing.
118
		_arguments \
119
			'-f[Force attach, even if in use]' \
120
			':pool name:_zfs_pool' \
121
			':virtual device:_files' \
122
			':virtual device:_files'
123
		;;
124
125
	(detach)
126
		_arguments \
127
			':pool name:_zfs_pool' \
128
			':virtual device:_files'
129
		;;
130
131
	(replace)
132
		_arguments -A "-*" \
133
			'-f[Force attach, even if in use]' \
134
			':pool name:_zfs_pool' \
135
			':virtual device:_files' \
136
			'::virtual device:_files'
137
		;;
138
139
	(scrub)
140
		_arguments -A "-*" \
141
			'-s[Stop scrubbing]' \
142
			'*:pool name:_zfs_pool'
143
		;;
144
145
	(export)
146
		_arguments -A "-*" \
147
			'-f[Forcefully unmount all datasets]' \
148
			'*:pool name:_zfs_pool'
149
		;;
150
151
	(import)
152
		# TODO: -o should complete options
153
		_arguments -A "-*" \
154
			'*-d[Search for devices or files in directory]:_files -/' \
155
			'-D[Destroyed pools]' \
156
			'-f[Force import]' \
157
			- set1 \
158
			'-o[Mount options]' \
159
			'-p[Set property]:property:_values -s , "property" $import_properties' \
160
			'-R[Alternate root]:_files -/' \
161
			'*:pool name or id:_zfs_pool' \
162
			'::new pool name:' \
163
			- set2 \
164
			'-a[All pools]'
165
		;;
166
167
	(get)
168
		_arguments -A "-*" \
169
			':property:_values -s , "property" $propnames all' \
170
			'*:pool name:_zfs_pool'
171
		;;
172
173
	(set)
174
		_arguments -A "-*" \
175
			':property:_values -s , "property" $properties' \
176
			'*:pool name:_zfs_pool'
177
		;;
178
179
	(upgrade)
180
		_arguments -A "-*" \
181
			- set1 \
182
			'-v[Display ZFS versions and descriptions]' \
183
			- set2 \
184
			'-a[Upgrade all pools]' \
185
			'*:pool name:_zfs_pool'
186
		;;
187
188
	(history)
189
		_arguments -A "-*" \
190
			'-i[Display internal events]' \
191
			'-l[Long format]' \
192
			'*:pool name:_zfs_pool'
193
		;;
194
195
	(*)
196
		_message "unknown zpool subcommand: $service"
197
		;;
198
	esac
199
}
200
201
_zpool "$@"

Return to bug 126457