| 1 |
command: 'none' |
| 2 |
category: 'meta' |
| 3 |
short: 'No completion, but specify that an argument is required' |
| 4 |
long: | |
| 5 |
Disables autocompletion for an option but still marks it as requiring an argument. |
| 6 |
|
| 7 |
Without specifying `complete`, the option would not take an argument. |
| 8 |
definition: | |
| 9 |
prog: 'example' |
| 10 |
options: |
| 11 |
- option_strings: ['--none'] |
| 12 |
complete: ['none'] |
| 13 |
output: | |
| 14 |
~ > example --none=<TAB> |
| 15 |
<NO OUTPUT> |
| 16 |
|
| 17 |
--- |
| 18 |
|
| 19 |
command: 'prefix' |
| 20 |
category: 'meta' |
| 21 |
synopsis: | |
| 22 |
['prefix', <PREFIX>, <COMPLETER>] |
| 23 |
short: 'Prefix completions with a string' |
| 24 |
long: | |
| 25 |
`PREFIX`: |
| 26 |
The string to prepend to each completion candidate. |
| 27 |
|
| 28 |
`COMPLETER`: |
| 29 |
The completer used to generate the completion candidates. |
| 30 |
definition: | |
| 31 |
prog: 'example' |
| 32 |
options: |
| 33 |
- option_strings: ['--prefix'] |
| 34 |
complete: ['prefix', 'input:', ['file']] |
| 35 |
output: | |
| 36 |
~ > example --prefix=<TAB> |
| 37 |
~ > example --prefix=input: |
| 38 |
|
| 39 |
~ > example --prefix=input:<TAB> |
| 40 |
~ > example --prefix=input:file1.txt |
| 41 |
|
| 42 |
--- |
| 43 |
|
| 44 |
command: 'combine' |
| 45 |
synopsis: | |
| 46 |
['combine', <COMPLETERS>] |
| 47 |
category: 'meta' |
| 48 |
short: 'Combine multiple completers' |
| 49 |
long: | |
| 50 |
Combines multiple completers into a single completer. |
| 51 |
|
| 52 |
`COMPLETERS`: |
| 53 |
A list of completers to combine. |
| 54 |
definition: | |
| 55 |
prog: 'example' |
| 56 |
options: |
| 57 |
- option_strings: ['--combine'] |
| 58 |
complete: ['combine', [['user'], ['pid']]] |
| 59 |
output: | |
| 60 |
~ > example --combine=avahi,daemon,<TAB> |
| 61 |
1439404 3488332 3571716 3607235 4134206 |
| 62 |
alpm avahi bin braph daemon |
| 63 |
root rtkit systemd-coredump systemd-journal-remote systemd-network |
| 64 |
[...] |
| 65 |
|
| 66 |
--- |
| 67 |
|
| 68 |
command: 'list' |
| 69 |
short: 'Complete comma-separated lists using a completer' |
| 70 |
synopsis: | |
| 71 |
['list', <COMPLETER>] |
| 72 |
|
| 73 |
['list', <COMPLETER>, <OPTIONS>] |
| 74 |
category: 'meta' |
| 75 |
long: | |
| 76 |
`COMPLETER`: |
| 77 |
The completer used to generate the list elements. |
| 78 |
|
| 79 |
`OPTIONS`: |
| 80 |
A dictionary containing additional options for configuring the list completion. |
| 81 |
|
| 82 |
- `separator`: The separator used between list elements. Defaults to `,` |
| 83 |
|
| 84 |
- `duplicates`: Allow duplicate values to be offered for completion. Defaults to `false` |
| 85 |
also: |
| 86 |
value_list: 'For completing comma-separated lists of values' |
| 87 |
file_list: 'For completing comma-separated lists of files' |
| 88 |
directory_list: 'For completing comma-separated lists of directories' |
| 89 |
key_value_list: 'For completing comma-separated lists of key=value pairs' |
| 90 |
definition: | |
| 91 |
prog: 'example' |
| 92 |
options: |
| 93 |
- option_strings: ['--user-list'] |
| 94 |
complete: ['list', ['user']] |
| 95 |
|
| 96 |
- option_strings: ['--option-list'] |
| 97 |
complete: ['list', ['choices', ['setuid', 'async', 'block']], {'separator': ':', 'duplicates': true}] |
| 98 |
output: | |
| 99 |
~ > example --user-list=avahi,daemon,<TAB> |
| 100 |
bin braph |
| 101 |
colord dbus |
| 102 |
dhcpcd git |
| 103 |
[...] |
| 104 |
|
| 105 |
~ > example --option-list=setuid:<TAB> |
| 106 |
setuid async block |
| 107 |
|
| 108 |
--- |
| 109 |
|
| 110 |
command: 'key_value_list' |
| 111 |
category: 'meta' |
| 112 |
synopsis: | |
| 113 |
['key_value_list', <PAIR_SEPARATOR>, <VALUE_SEPARATOR>, <DEFINITIONS>] |
| 114 |
|
| 115 |
['key_value_list', <PAIR_SEPARATOR>, <VALUE_SEPARATOR>, <DEFINITIONS>, <CONDITION_FUNCTION>] |
| 116 |
short: 'Complete comma-separated lists of key=value pairs' |
| 117 |
long: | |
| 118 |
`PAIR_SEPARATOR`: |
| 119 |
The separator used to separate individual key-value pairs. |
| 120 |
|
| 121 |
`VALUE_SEPARATOR`: |
| 122 |
The separator used to separate a key from its value. |
| 123 |
|
| 124 |
`DEFINITIONS`: |
| 125 |
A list of key definitions. |
| 126 |
|
| 127 |
Each definition has one of the following forms: |
| 128 |
|
| 129 |
`[<KEY>, <DESCRIPTION>, <COMPLETER>]` |
| 130 |
|
| 131 |
-- OR -- |
| 132 |
|
| 133 |
`[<KEY>, <DESCRIPTION>, <COMPLETER>, <EXCLUDES>]` |
| 134 |
|
| 135 |
`KEY`: |
| 136 |
The name of the key. |
| 137 |
Prefix the name with `*` to allow the key to be completed multiple times. |
| 138 |
|
| 139 |
`DESCRIPTION`: |
| 140 |
A description shown during completion. |
| 141 |
Use `null` to omit the description. |
| 142 |
|
| 143 |
`COMPLETER`: |
| 144 |
The completer used for the value of the key. |
| 145 |
Use `null` if the key does not take an argument. |
| 146 |
Use `['none']` if the key takes an argument but cannot be completed. |
| 147 |
|
| 148 |
`EXCLUDES`: |
| 149 |
A list of keys that should no longer be offered for completion once this key has been used. |
| 150 |
|
| 151 |
`CONDITION_FUNCTION`: |
| 152 |
A command or function that determines whether a key should be offered for |
| 153 |
completion. |
| 154 |
|
| 155 |
It is invoked with the key as its first argument. If it exits with status `0`, |
| 156 |
the key is offered for completion. Any non-zero exit status suppresses the |
| 157 |
key. |
| 158 |
|
| 159 |
By default, each key is offered for completion only once. |
| 160 |
To allow a key to be completed multiple times, prefix its name with `*`. |
| 161 |
also: |
| 162 |
list: 'For completing comma-separated lists using a completer' |
| 163 |
value_list: 'For completing comma-separated lists of values' |
| 164 |
key_value_pair: 'For completing single key=value pairs' |
| 165 |
key_value_list_exec: 'For completing comma-separated lists of key=value pairs (dynamically generated by a function)' |
| 166 |
definition: | |
| 167 |
prog: 'example' |
| 168 |
options: |
| 169 |
- option_strings: ['--key-value-list'] |
| 170 |
complete: ['key_value_list', ',', '=', [ |
| 171 |
['flag', 'An option flag', null], |
| 172 |
['nodesc', null, null], |
| 173 |
['nocomp', 'An option with arg but without completer', ['none']], |
| 174 |
['user', 'Takes a username', ['user']], |
| 175 |
['*repeatable', 'This option is repeatable', null], |
| 176 |
['exclusive', 'This option disables other options', null, ['flag', 'nodesc', 'nocomp']], |
| 177 |
['check', 'Specify file name conversions', ['choices', { |
| 178 |
'relaxed': 'convert to lowercase before lookup', |
| 179 |
'strict': 'no conversion' |
| 180 |
}]] |
| 181 |
]] |
| 182 |
output: | |
| 183 |
~ > example --key-value-list flag,user=<TAB> |
| 184 |
bin braph |
| 185 |
colord dbus |
| 186 |
dhcpcd git |
| 187 |
[...] |
| 188 |
|
| 189 |
--- |
| 190 |
|
| 191 |
command: 'key_value_pair' |
| 192 |
category: 'meta' |
| 193 |
synopsis: | |
| 194 |
['key_value_pair', <VALUE_SEPARATOR>, <DEFINITIONS>] |
| 195 |
|
| 196 |
['key_value_pair', <VALUE_SEPARATOR>, <DEFINITIONS>, <CONDITION_FUNCTION>] |
| 197 |
short: 'Complete single key=value pairs' |
| 198 |
long: | |
| 199 |
`VALUE_SEPARATOR`: |
| 200 |
The separator used to separate a key from its value. |
| 201 |
|
| 202 |
`DEFINITIONS`: |
| 203 |
A list of key definitions. |
| 204 |
|
| 205 |
Each definition has the following form: |
| 206 |
|
| 207 |
`[<KEY>, <DESCRIPTION>, <COMPLETER>]` |
| 208 |
|
| 209 |
`KEY`: |
| 210 |
The name of the key. |
| 211 |
Prefix the name with `*` to allow the key to be completed multiple times. |
| 212 |
|
| 213 |
`DESCRIPTION`: |
| 214 |
A description shown during completion. |
| 215 |
Use `null` to omit the description. |
| 216 |
|
| 217 |
`COMPLETER`: |
| 218 |
The completer used for the value of the key. |
| 219 |
Use `null` if the key does not take an argument. |
| 220 |
Use `['none']` if the key takes an argument but cannot be completed. |
| 221 |
|
| 222 |
`CONDITION_FUNCTION`: |
| 223 |
A command or function that determines whether a key should be offered for |
| 224 |
completion. |
| 225 |
|
| 226 |
It is invoked with the key as its first argument. If it exits with status `0`, |
| 227 |
the key is offered for completion. Any non-zero exit status suppresses the |
| 228 |
key. |
| 229 |
also: |
| 230 |
key_value_list: 'For completing comma-separated lists of key=value pairs' |
| 231 |
key_value_pair_exec: 'For completing single key=value pairs (dynamically generated by a function)' |
| 232 |
definition: | |
| 233 |
prog: 'example' |
| 234 |
options: |
| 235 |
- option_strings: ['--key-value-pair'] |
| 236 |
complete: ['key_value_pair', '=', [ |
| 237 |
['flag', 'An option flag', null], |
| 238 |
['nodesc', null, null], |
| 239 |
['nocomp', 'An option with arg but without completer', ['none']], |
| 240 |
['user', 'Takes a username', ['user']], |
| 241 |
['check', 'Specify file name conversions', ['choices', { |
| 242 |
'relaxed': 'convert to lowercase before lookup', |
| 243 |
'strict': 'no conversion' |
| 244 |
}]] |
| 245 |
]] |
| 246 |
output: | |
| 247 |
~ > example --key-value-pair <TAB> |
| 248 |
check -- Specify file name conversions |
| 249 |
flag -- An option flag |
| 250 |
nocomp -- An option with arg but without completer |
| 251 |
user -- Takes a username |
| 252 |
nodesc |
| 253 |
|
| 254 |
~ > example --key-value-pair user=<TAB> |
| 255 |
bin braph |
| 256 |
colord dbus |
| 257 |
dhcpcd git |
| 258 |
[...] |
| 259 |
|
| 260 |
--- |
| 261 |
|
| 262 |
command: 'integer' |
| 263 |
category: 'basic' |
| 264 |
synopsis: | |
| 265 |
['integer'] |
| 266 |
|
| 267 |
['integer', <OPTIONS>] |
| 268 |
short: 'Complete integer values' |
| 269 |
long: | |
| 270 |
`OPTIONS`: |
| 271 |
A dictionary containing additional options for configuring the completion. |
| 272 |
|
| 273 |
- `min`: The minimum allowed value. |
| 274 |
|
| 275 |
- `max`: The maximum allowed value. |
| 276 |
|
| 277 |
- `suffixes`: A dictionary of suffixes and their descriptions. The suffix is appended to the completed value. |
| 278 |
|
| 279 |
- `help`: The help text shown during completion. If not specified, the `help` attribute of the option is used. |
| 280 |
also: |
| 281 |
float: 'For completing floating-point values' |
| 282 |
range: 'For completing sequences of integers' |
| 283 |
definition: | |
| 284 |
prog: 'example' |
| 285 |
options: |
| 286 |
- option_strings: ['--time'] |
| 287 |
complete: ['integer', {'suffixes': {'s': 'seconds', 'm': 'minutes', 'h': 'hours'}}] |
| 288 |
output: | |
| 289 |
~ > example --integer=3<TAB> |
| 290 |
s -- seconds m -- minutes h -- hours |
| 291 |
|
| 292 |
--- |
| 293 |
|
| 294 |
command: 'float' |
| 295 |
category: 'basic' |
| 296 |
synopsis: | |
| 297 |
['float'] |
| 298 |
|
| 299 |
['float', <OPTIONS>] |
| 300 |
short: 'Complete floating-point values' |
| 301 |
long: | |
| 302 |
`OPTIONS`: |
| 303 |
A dictionary containing additional options for configuring the completion. |
| 304 |
|
| 305 |
- `min`: The minimum allowed value. |
| 306 |
|
| 307 |
- `max`: The maximum allowed value. |
| 308 |
|
| 309 |
- `suffixes`: A dictionary of suffixes and their descriptions. The suffix is appended to the completed value. |
| 310 |
|
| 311 |
- `help`: The help text shown during completion. If not specified, the `help` attribute of the option is used. |
| 312 |
also: |
| 313 |
integer: 'For completing integer values' |
| 314 |
definition: | |
| 315 |
prog: 'example' |
| 316 |
options: |
| 317 |
- option_strings: ['--time'] |
| 318 |
complete: ['float', {'suffixes': {'s': 'seconds', 'm': 'minutes', 'h': 'hours'}}] |
| 319 |
output: | |
| 320 |
~ > example --time=3.0<TAB> |
| 321 |
s -- seconds m -- minutes h -- hours |
| 322 |
|
| 323 |
--- |
| 324 |
|
| 325 |
command: 'file' |
| 326 |
category: 'basic' |
| 327 |
synopsis: | |
| 328 |
['file'] |
| 329 |
|
| 330 |
['file', <OPTIONS>] |
| 331 |
short: 'Complete file names' |
| 332 |
long: | |
| 333 |
`OPTIONS`: |
| 334 |
A dictionary containing additional options for configuring the completion. |
| 335 |
|
| 336 |
- `directory`: Restrict completion to files inside the specified directory. |
| 337 |
|
| 338 |
- `extensions`: A list of file extensions to offer for completion. |
| 339 |
|
| 340 |
- `fuzzy`: |
| 341 |
Enable fuzzy extension matching. |
| 342 |
By default, files must end with one of the specified extensions. |
| 343 |
With fuzzy matching enabled, files with additional suffixes are also matched, for example `foo.txt.1`. |
| 344 |
|
| 345 |
- `ignore_globs`: |
| 346 |
A list of Bash globs for files that should not be offered for completion. |
| 347 |
|
| 348 |
**NOTE:** Restricting completion to specific file extensions only makes sense |
| 349 |
if the program being completed actually expects files of those types. On |
| 350 |
Unix-like systems, file extensions generally have no inherent meaning and are |
| 351 |
only conventions. |
| 352 |
also: |
| 353 |
file_list: 'For completing comma-separated lists of files' |
| 354 |
mime_file: 'For completing files by MIME type' |
| 355 |
definition: | |
| 356 |
prog: 'example' |
| 357 |
options: |
| 358 |
- option_strings: ['--file'] |
| 359 |
complete: ['file'] |
| 360 |
|
| 361 |
- option_strings: ['--file-tmp'] |
| 362 |
complete: ['file', {'directory': '/tmp'}] |
| 363 |
|
| 364 |
- option_strings: ['--file-ext'] |
| 365 |
complete: ['file', {'extensions': ['c', 'cpp']}] |
| 366 |
|
| 367 |
- option_strings: ['--file-ignore'] |
| 368 |
complete: ['file', {'ignore_globs': ['*.[tT][xX][tT]', '*.c++']}] |
| 369 |
output: | |
| 370 |
~ > example --file=<TAB> |
| 371 |
dir1/ dir2/ file1 file2 |
| 372 |
|
| 373 |
~ > example --file-ext=<TAB> |
| 374 |
dir1/ dir2/ file.c file.cpp |
| 375 |
|
| 376 |
--- |
| 377 |
|
| 378 |
command: 'directory' |
| 379 |
category: 'basic' |
| 380 |
synopsis: | |
| 381 |
['directory'] |
| 382 |
|
| 383 |
['directory', <OPTIONS>] |
| 384 |
short: 'Complete directory names' |
| 385 |
long: | |
| 386 |
`OPTIONS`: |
| 387 |
A dictionary containing additional options for configuring the completion. |
| 388 |
|
| 389 |
- `directory`: Restrict completion to directories inside the specified directory. |
| 390 |
also: |
| 391 |
directory_list: 'For completing comma-separated lists of directories' |
| 392 |
definition: | |
| 393 |
prog: 'example' |
| 394 |
options: |
| 395 |
- option_strings: ['--directory'] |
| 396 |
complete: ['directory'] |
| 397 |
|
| 398 |
- option_strings: ['--directory-tmp'] |
| 399 |
complete: ['directory', {'directory': '/tmp'}] |
| 400 |
output: | |
| 401 |
~ > example --directory=<TAB> |
| 402 |
dir1/ dir2/ |
| 403 |
|
| 404 |
--- |
| 405 |
|
| 406 |
command: 'file_list' |
| 407 |
category: 'basic' |
| 408 |
synopsis: | |
| 409 |
['file_list'] |
| 410 |
|
| 411 |
['file_list', <OPTIONS>] |
| 412 |
short: 'Complete comma-separated lists of files' |
| 413 |
long: | |
| 414 |
This is an alias for `['list', ['file']]`. |
| 415 |
|
| 416 |
`OPTIONS`: |
| 417 |
A dictionary containing additional options for configuring the completion. |
| 418 |
|
| 419 |
- `directory`: |
| 420 |
Restrict completion to files inside the specified directory. |
| 421 |
|
| 422 |
- `extensions`: |
| 423 |
A list of file extensions to offer for completion. |
| 424 |
|
| 425 |
- `fuzzy`: |
| 426 |
Enable fuzzy extension matching. By default, files must end with one of |
| 427 |
the specified extensions. With fuzzy matching enabled, files with |
| 428 |
additional suffixes are also matched, for example `foo.txt.1`. |
| 429 |
|
| 430 |
- `ignore_globs`: |
| 431 |
A list of Bash globs for files that should not be offered for completion. |
| 432 |
|
| 433 |
- `duplicates`: |
| 434 |
Allow duplicate values to be offered for completion. Defaults to `false`. |
| 435 |
|
| 436 |
- `separator`: |
| 437 |
The separator used between list elements. Defaults to `,`. |
| 438 |
also: |
| 439 |
list: 'For completing comma-separted lists using a completer' |
| 440 |
file: 'For completing file names' |
| 441 |
directory_list: 'For completing comma-separated lists of directories' |
| 442 |
definition: | |
| 443 |
prog: 'example' |
| 444 |
options: |
| 445 |
- option_strings: ['--file-list'] |
| 446 |
complete: ['file_list'] |
| 447 |
output: | |
| 448 |
~ > example --file-list=file1,file2,<TAB> |
| 449 |
file3 file4 |
| 450 |
|
| 451 |
--- |
| 452 |
|
| 453 |
command: 'directory_list' |
| 454 |
category: 'basic' |
| 455 |
synopsis: | |
| 456 |
['directory_list'] |
| 457 |
|
| 458 |
['directory_list', <OPTIONS>] |
| 459 |
short: 'Complete comma-separated lists of directories' |
| 460 |
long: | |
| 461 |
This is an alias for `['list', ['directory']]`. |
| 462 |
|
| 463 |
`OPTIONS`: |
| 464 |
A dictionary containing additional options for configuring the completion. |
| 465 |
|
| 466 |
- `directory`: |
| 467 |
Restrict completion to directories inside the specified directory. |
| 468 |
|
| 469 |
- `duplicates`: |
| 470 |
Allow duplicate values to be offered for completion. Defaults to `false`. |
| 471 |
|
| 472 |
- `separator`: |
| 473 |
The separator used between list elements. Defaults to `,`. |
| 474 |
also: |
| 475 |
list: 'For completion comma-separated lists using a completer' |
| 476 |
directory: 'For completing directory names' |
| 477 |
file_list: 'For completing comma-separated lists of files' |
| 478 |
definition: | |
| 479 |
prog: 'example' |
| 480 |
options: |
| 481 |
- option_strings: ['--directory-list'] |
| 482 |
complete: ['directory_list'] |
| 483 |
output: | |
| 484 |
~ > example --directory-list=directory1,directory2,<TAB> |
| 485 |
directory3 directory4 |
| 486 |
|
| 487 |
--- |
| 488 |
|
| 489 |
command: 'mime_file' |
| 490 |
category: 'basic' |
| 491 |
synopsis: | |
| 492 |
['mime_file', <MIME_REGEX>] |
| 493 |
short: 'Complete files by MIME type' |
| 494 |
long: | |
| 495 |
`MIME_REGEX`: |
| 496 |
An extended regular expression used to match MIME types. |
| 497 |
The expression is passed to `grep -E` to filter the results. |
| 498 |
definition: | |
| 499 |
prog: 'example' |
| 500 |
options: |
| 501 |
- option_strings: ['--image'] |
| 502 |
complete: ['mime_file', 'image/'] |
| 503 |
output: | |
| 504 |
~ > example --image=<TAB> |
| 505 |
dir1/ dir2/ img.png img.jpg |
| 506 |
|
| 507 |
--- |
| 508 |
|
| 509 |
command: 'choices' |
| 510 |
category: 'basic' |
| 511 |
synopsis: | |
| 512 |
['choices', <ITEMS>] |
| 513 |
short: 'Complete from a predefined set of values' |
| 514 |
long: | |
| 515 |
`ITEMS`: |
| 516 |
A list or dictionary containing the values to offer for completion. |
| 517 |
|
| 518 |
If a list is supplied, all items are offered without descriptions. |
| 519 |
|
| 520 |
If a dictionary is supplied, the keys are used as completion values and the |
| 521 |
values are used as descriptions. |
| 522 |
notes: |
| 523 |
- 'If the completion suggestions should appear in their original order, set `nosort` to `true`' |
| 524 |
definition: | |
| 525 |
prog: 'example' |
| 526 |
options: |
| 527 |
- option_strings: ['--choices-1'] |
| 528 |
complete: ['choices', ['Item 1', 'Item 2']] |
| 529 |
|
| 530 |
- option_strings: ['--choices-2'] |
| 531 |
complete: ['choices', {'Item 1': 'Description 1', 'Item 2': 'Description 2'}] |
| 532 |
|
| 533 |
- option_strings: ['--choices-keep-order'] |
| 534 |
complete: ['choices', ['zebra', 'cat', 'monkey']] |
| 535 |
nosort: true |
| 536 |
output: | |
| 537 |
~ > example --choices-2=<TAB> |
| 538 |
Item 1 (Description 1) Item 2 (Description 2) |
| 539 |
|
| 540 |
~ > example --choices-keep-order=<TAB> |
| 541 |
zebra cat monkey |
| 542 |
|
| 543 |
--- |
| 544 |
|
| 545 |
command: 'value_list' |
| 546 |
category: 'basic' |
| 547 |
synopsis: | |
| 548 |
['value_list', <OPTIONS>] |
| 549 |
short: 'Complete comma-separated lists of values' |
| 550 |
long: | |
| 551 |
`OPTIONS`: |
| 552 |
A dictionary containing additional options for configuring the completion. |
| 553 |
|
| 554 |
- `values`: |
| 555 |
A list or dictionary containing the values to offer for completion. |
| 556 |
|
| 557 |
If a list is supplied, all values are offered without descriptions. |
| 558 |
|
| 559 |
If a dictionary is supplied, the keys are used as completion values and |
| 560 |
the values are used as descriptions. |
| 561 |
|
| 562 |
- `separator`: |
| 563 |
The separator used between list elements. Defaults to `,`. |
| 564 |
|
| 565 |
- `duplicates`: |
| 566 |
Allow duplicate values to be offered for completion. Defaults to `false`. |
| 567 |
also: |
| 568 |
list: 'For completing comma-separated lists using a completer' |
| 569 |
key_value_list: 'For completing comma-separated lists of key=value pairs' |
| 570 |
definition: | |
| 571 |
prog: 'example' |
| 572 |
options: |
| 573 |
- option_strings: ['--value-list-1'] |
| 574 |
complete: ['value_list', {'values': ['exec', 'noexec']}] |
| 575 |
|
| 576 |
- option_strings: ['--value-list-2'] |
| 577 |
complete: ['value_list', {'values': {'one': 'Description 1', 'two': 'Description 2'}}] |
| 578 |
output: | |
| 579 |
~ > example --value-list-1=<TAB> |
| 580 |
exec noexec |
| 581 |
|
| 582 |
~ > example --value-list-1=exec,<TAB> |
| 583 |
noexec |
| 584 |
|
| 585 |
~ > example --value-list-2=<TAB> |
| 586 |
one -- Description 1 |
| 587 |
two -- Description 2 |
| 588 |
|
| 589 |
--- |
| 590 |
|
| 591 |
command: 'exec' |
| 592 |
category: 'custom' |
| 593 |
synopsis: | |
| 594 |
['exec', <COMMAND>] |
| 595 |
short: 'Complete values from the output of a command or function' |
| 596 |
long: | |
| 597 |
`COMMAND`: |
| 598 |
The command or function to execute. Its output must be formatted as tab-separated values: |
| 599 |
|
| 600 |
``` |
| 601 |
<ITEM_1>\t<DESCRIPTION_1> |
| 602 |
<ITEM_2>\t<DESCRIPTION_2> |
| 603 |
[...] |
| 604 |
``` |
| 605 |
|
| 606 |
Each line represents one completion candidate. The item and its description are separated by a tab character. |
| 607 |
also: |
| 608 |
exec_fast: 'Faster implementation of exec' |
| 609 |
exec_internal: "Use the shell's internal completion mechanisms" |
| 610 |
notes: |
| 611 |
- 'Functions can be put inside a file and included with `--include-file`' |
| 612 |
definition: | |
| 613 |
prog: 'example' |
| 614 |
options: |
| 615 |
- option_strings: ['--exec'] |
| 616 |
complete: ['exec', "printf '%s\\t%s\\n' 'Item 1' 'Description 1' 'Item 2' 'Description 2'"] |
| 617 |
output: | |
| 618 |
~ > example --exec=<TAB> |
| 619 |
Item 1 (Description 1) Item 2 (Description 2) |
| 620 |
|
| 621 |
--- |
| 622 |
|
| 623 |
command: 'exec_fast' |
| 624 |
category: 'custom' |
| 625 |
synopsis: | |
| 626 |
['exec_fast', <COMMAND>] |
| 627 |
short: 'Complete values from the output of a command or function (fast and unsafe)' |
| 628 |
long: | |
| 629 |
Faster version of `exec` for handling large amounts of data. |
| 630 |
|
| 631 |
Unlike `exec`, this implementation does not safely handle arbitrary output. |
| 632 |
Completion items must not contain whitespace or special shell characters. |
| 633 |
notes: |
| 634 |
- 'Functions can be put inside a file and included with `--include-file`' |
| 635 |
definition: | |
| 636 |
prog: 'example' |
| 637 |
options: |
| 638 |
- option_strings: ['--exec-fast'] |
| 639 |
complete: ['exec_fast', "printf '%s\\t%s\\n' 1 one 2 two"] |
| 640 |
output: | |
| 641 |
~ > example --exec-fast=<TAB> |
| 642 |
1 -- one |
| 643 |
2 -- one |
| 644 |
|
| 645 |
--- |
| 646 |
|
| 647 |
command: 'exec_internal' |
| 648 |
category: 'custom' |
| 649 |
synopsis: | |
| 650 |
['exec_internal', <COMMAND>] |
| 651 |
short: "Use the shell's internal completion mechanisms" |
| 652 |
long: | |
| 653 |
Execute a function that internally modifies the completion state. |
| 654 |
|
| 655 |
This is useful if a more advanced completion is needed. |
| 656 |
|
| 657 |
For **Bash**, it might look like: |
| 658 |
|
| 659 |
```sh |
| 660 |
my_completion_func() { |
| 661 |
COMPREPLY=( $(compgen -W 'read write append' -- '$cur') ) |
| 662 |
} |
| 663 |
``` |
| 664 |
|
| 665 |
For **Zsh**, it might look like: |
| 666 |
|
| 667 |
```sh |
| 668 |
my_completion_func() { |
| 669 |
local items=( |
| 670 |
read:'Read data from a file' |
| 671 |
write:'Write data from a file' |
| 672 |
append:'Append data to a file' |
| 673 |
) |
| 674 |
|
| 675 |
_describe 'my items' items |
| 676 |
} |
| 677 |
``` |
| 678 |
|
| 679 |
For **Fish**, it might look like: |
| 680 |
|
| 681 |
```sh |
| 682 |
function my_completion_func |
| 683 |
printf '%s\t%s\n' \ |
| 684 |
read 'Read data from a file' \ |
| 685 |
write 'Write data from a file' \ |
| 686 |
append 'Append data to a file' |
| 687 |
end |
| 688 |
``` |
| 689 |
notes: |
| 690 |
- 'Functions can be put inside a file and included with `--include-file`' |
| 691 |
definition: | |
| 692 |
prog: 'example' |
| 693 |
options: |
| 694 |
- option_strings: ['--exec-internal'] |
| 695 |
complete: ['exec_internal', 'my_completion_func'] |
| 696 |
output: | |
| 697 |
~ > example --exec-internal=<TAB> |
| 698 |
append -- Append data to a file |
| 699 |
read -- Read data from a file |
| 700 |
write -- Write data from a file |
| 701 |
|
| 702 |
--- |
| 703 |
|
| 704 |
command: 'key_value_pair_exec' |
| 705 |
category: 'custom' |
| 706 |
synopsis: | |
| 707 |
['key_value_pair_exec', <VALUE_SEPARATOR>, <COMMAND>] |
| 708 |
short: 'Complete dynamically generated a key=value pairs' |
| 709 |
long: | |
| 710 |
`VALUE_SEPARATOR`: |
| 711 |
The separator used to separate a key from its value. |
| 712 |
|
| 713 |
`COMMAND`: |
| 714 |
The command or function used to generate the available keys and values. |
| 715 |
|
| 716 |
If invoked without arguments, it must output the available keys in the |
| 717 |
following format: |
| 718 |
|
| 719 |
``` |
| 720 |
<KEY_1>[=]\t<DESCRIPTION_1> |
| 721 |
<KEY_2>[=]\t<DESCRIPTION_2> |
| 722 |
[...] |
| 723 |
``` |
| 724 |
|
| 725 |
Appending `=` to a key indicates that it requires a value. |
| 726 |
|
| 727 |
If invoked with a single argument, the argument is the selected key. The |
| 728 |
command must output the possible values for that key in the following |
| 729 |
format: |
| 730 |
|
| 731 |
``` |
| 732 |
<ITEM_1>\t<DESCRIPTION_1> |
| 733 |
<ITEM_2>\t<DESCRIPTION_2> |
| 734 |
[...] |
| 735 |
``` |
| 736 |
|
| 737 |
Each line represents one completion candidate. The item and its description |
| 738 |
are separated by a tab character. |
| 739 |
|
| 740 |
Example function: |
| 741 |
|
| 742 |
```sh |
| 743 |
_complete_key_value_pair() { |
| 744 |
if (( $# == 0 )); then |
| 745 |
printf '%s\t%s\n' \ |
| 746 |
'flag' 'a flag' \ |
| 747 |
'option=' 'option with value' |
| 748 |
else |
| 749 |
case '$1' in |
| 750 |
option) |
| 751 |
printf '%s\t%s\n' \ |
| 752 |
'foo' 'a foo value' \ |
| 753 |
'bar' 'a bar value';; |
| 754 |
esac |
| 755 |
fi |
| 756 |
} |
| 757 |
``` |
| 758 |
also: |
| 759 |
key_value_pair: 'For completing single key=value pairs' |
| 760 |
notes: |
| 761 |
- 'Functions can be put inside a file and included with `--include-file`' |
| 762 |
definition: | |
| 763 |
prog: 'example' |
| 764 |
options: |
| 765 |
- option_strings: ['-o'] |
| 766 |
complete: ['key_value_pair_exec', '=', '_complete_key_value_pair'] |
| 767 |
output: | |
| 768 |
~ > example -o <TAB> |
| 769 |
flag -- a flag |
| 770 |
option -- option with value |
| 771 |
|
| 772 |
~ > example -o option=<TAB> |
| 773 |
foo -- a foo value |
| 774 |
bar -- a bar value |
| 775 |
|
| 776 |
--- |
| 777 |
|
| 778 |
command: 'key_value_list_exec' |
| 779 |
category: 'custom' |
| 780 |
synopsis: | |
| 781 |
['key_value_list_exec', <PAIR_SEPARATOR>, <VALUE_SEPARATOR>, <COMMAND>] |
| 782 |
short: 'Complete dynamically generated comma-separted lists of key=value pairs' |
| 783 |
long: | |
| 784 |
`PAIR_SEPARATOR`: |
| 785 |
The separator used to separate individual key-value pairs. |
| 786 |
|
| 787 |
`VALUE_SEPARATOR`: |
| 788 |
The separator used to separate a key from its value. |
| 789 |
|
| 790 |
`COMMAND`: |
| 791 |
The command or function used to generate the available keys and values. |
| 792 |
|
| 793 |
If invoked without arguments, it must output the available keys in the |
| 794 |
following format: |
| 795 |
|
| 796 |
``` |
| 797 |
[*]<KEY_1>[=][?]\t<DESCRIPTION_1>\t<EXCLUDES> |
| 798 |
[*]<KEY_2>[=][?]\t<DESCRIPTION_2>\t<EXCLUDES> |
| 799 |
[...] |
| 800 |
``` |
| 801 |
|
| 802 |
Prefixing a key with `*` marks it as repeatable. |
| 803 |
|
| 804 |
Appending `=` to a key indicates that it requires a value. |
| 805 |
|
| 806 |
Appending `=?` to a key indicates that it requires an optional value. |
| 807 |
|
| 808 |
`EXCLUDES` is a space-separated list of keys that should no longer be |
| 809 |
offered once the current key has been used. |
| 810 |
|
| 811 |
If invoked with a single argument, the argument is the selected key. |
| 812 |
The command must output the possible values for that key in the following |
| 813 |
format: |
| 814 |
|
| 815 |
``` |
| 816 |
<ITEM_1>\t<DESCRIPTION_1> |
| 817 |
<ITEM_2>\t<DESCRIPTION_2> |
| 818 |
[...] |
| 819 |
``` |
| 820 |
|
| 821 |
Each line represents one completion candidate. The item and its description |
| 822 |
are separated by a tab character. |
| 823 |
|
| 824 |
Example function: |
| 825 |
|
| 826 |
```sh |
| 827 |
_complete_key_value_list() { |
| 828 |
if (( $# == 0 )); then |
| 829 |
printf '%s\t%s\t%s\n' \ |
| 830 |
'flag' 'option without an argument' '' \ |
| 831 |
'argument=' 'option with an argument' '' \ |
| 832 |
'optional=?' 'option with an optional argument' '' \ |
| 833 |
'*repeatable' 'a repeatable option' '' \ |
| 834 |
'excludes' 'disable options' 'flag argument' |
| 835 |
else |
| 836 |
case '$1' in |
| 837 |
argument|optional) |
| 838 |
printf '%s\t%s\n' \ |
| 839 |
'foo' 'a foo value' \ |
| 840 |
'bar' 'a bar value';; |
| 841 |
esac |
| 842 |
fi |
| 843 |
} |
| 844 |
``` |
| 845 |
also: |
| 846 |
key_value_list: 'For completing comma-separated lists of key=value pairs' |
| 847 |
notes: |
| 848 |
- 'Functions can be put inside a file and included with `--include-file`' |
| 849 |
definition: | |
| 850 |
prog: 'example' |
| 851 |
options: |
| 852 |
- option_strings: ['-o'] |
| 853 |
complete: ['key_value_list_exec', ',', '=', '_complete_key_value_list'] |
| 854 |
output: | |
| 855 |
~ > example -o <TAB> |
| 856 |
argument -- option with an argument |
| 857 |
excludes -- disable options |
| 858 |
flag -- option without an argument |
| 859 |
optional -- option with an optional argument |
| 860 |
repeatable -- a repeatable option |
| 861 |
|
| 862 |
~ > example -o argument=<TAB> |
| 863 |
foo -- a foo value |
| 864 |
bar -- a bar value |
| 865 |
|
| 866 |
~ > example -o excludes,<TAB> |
| 867 |
optional -- option with an optional argument |
| 868 |
repeatable -- a repeatable option |
| 869 |
|
| 870 |
--- |
| 871 |
|
| 872 |
command: 'range' |
| 873 |
category: 'basic' |
| 874 |
synopsis: | |
| 875 |
['range', <START>, <STOP>] |
| 876 |
|
| 877 |
['range', <START>, <STOP>, <STEP>] |
| 878 |
short: 'Complete sequences of integers' |
| 879 |
long: | |
| 880 |
`START`: |
| 881 |
The first value of the range. |
| 882 |
|
| 883 |
`STOP`: |
| 884 |
The last value of the range. |
| 885 |
|
| 886 |
`STEP`: |
| 887 |
The increment between values. Defaults to `1`. |
| 888 |
definition: | |
| 889 |
prog: 'example' |
| 890 |
options: |
| 891 |
- option_strings: ['--range-1'] |
| 892 |
complete: ['range', 1, 9] |
| 893 |
|
| 894 |
- option_strings: ['--range-2'] |
| 895 |
complete: ['range', 1, 9, 2] |
| 896 |
output: | |
| 897 |
~ > example --range-1=<TAB> |
| 898 |
1 2 3 4 5 6 7 8 9 |
| 899 |
|
| 900 |
~ > example --range-2=<TAB> |
| 901 |
1 3 5 7 9 |
| 902 |
|
| 903 |
--- |
| 904 |
|
| 905 |
command: 'signal' |
| 906 |
category: 'basic' |
| 907 |
short: 'Complete signal names' |
| 908 |
definition: | |
| 909 |
prog: 'example' |
| 910 |
options: |
| 911 |
- option_strings: ['--signal'] |
| 912 |
complete: ['signal'] |
| 913 |
output: | |
| 914 |
~ > example --signal=<TAB> |
| 915 |
ABRT -- Process abort signal |
| 916 |
ALRM -- Alarm clock |
| 917 |
BUS -- Access to an undefined portion of a memory object |
| 918 |
CHLD -- Child process terminated, stopped, or continued |
| 919 |
CONT -- Continue executing, if stopped |
| 920 |
FPE -- Erroneous arithmetic operation |
| 921 |
HUP -- Hangup |
| 922 |
ILL -- Illegal instruction |
| 923 |
INT -- Terminal interrupt signal |
| 924 |
[...] |
| 925 |
|
| 926 |
--- |
| 927 |
|
| 928 |
command: 'hostname' |
| 929 |
category: 'basic' |
| 930 |
short: 'Complete hostnames' |
| 931 |
also: |
| 932 |
ip_address: 'For completing local IP addresses' |
| 933 |
definition: | |
| 934 |
prog: 'example' |
| 935 |
options: |
| 936 |
- option_strings: ['--hostname'] |
| 937 |
complete: ['hostname'] |
| 938 |
output: | |
| 939 |
~ > example --hostname=<TAB> |
| 940 |
localhost |
| 941 |
|
| 942 |
--- |
| 943 |
|
| 944 |
command: 'process' |
| 945 |
category: 'basic' |
| 946 |
short: 'Complete process names' |
| 947 |
also: |
| 948 |
pid: 'For completing process IDs' |
| 949 |
definition: | |
| 950 |
prog: 'example' |
| 951 |
options: |
| 952 |
- option_strings: ['--process'] |
| 953 |
complete: ['process'] |
| 954 |
output: | |
| 955 |
~ > example --process=s<TAB> |
| 956 |
scsi_eh_0 scsi_eh_1 scsi_eh_2 scsi_eh_3 scsi_eh_4 |
| 957 |
scsi_eh_5 sh sudo syndaemon systemd |
| 958 |
systemd-journald systemd-logind systemd-udevd |
| 959 |
|
| 960 |
--- |
| 961 |
|
| 962 |
command: 'pid' |
| 963 |
category: 'basic' |
| 964 |
short: 'Complete process IDs' |
| 965 |
also: |
| 966 |
process: 'For completing process names' |
| 967 |
definition: | |
| 968 |
prog: 'example' |
| 969 |
options: |
| 970 |
- option_strings: ['--pid'] |
| 971 |
complete: ['pid'] |
| 972 |
output: | |
| 973 |
~ > example --pid=<TAB> |
| 974 |
1 13 166 19 254 31 45 |
| 975 |
1006 133315 166441 19042 26 32 46 |
| 976 |
10150 1392 166442 195962 27 33 4609 |
| 977 |
|
| 978 |
--- |
| 979 |
|
| 980 |
command: 'filesystem_type' |
| 981 |
category: 'basic' |
| 982 |
short: 'Complete filesystem types' |
| 983 |
definition: | |
| 984 |
prog: 'example' |
| 985 |
options: |
| 986 |
- option_strings: ['--filesystem-type'] |
| 987 |
complete: ['filesystem_type'] |
| 988 |
output: | |
| 989 |
~ > example --filesystem-type=<TAB> |
| 990 |
adfs autofs bdev bfs binder binfmt_misc bpf |
| 991 |
cgroup cgroup2 configfs cramfs debugfs devpts devtmpfs |
| 992 |
[...] |
| 993 |
|
| 994 |
--- |
| 995 |
|
| 996 |
command: 'command' |
| 997 |
category: 'basic' |
| 998 |
synopsis: | |
| 999 |
['command'] |
| 1000 |
|
| 1001 |
['command', <OPTIONS>] |
| 1002 |
short: 'Complete command names' |
| 1003 |
long: | |
| 1004 |
This completer provides completion suggestions for executable commands available in the system's `$PATH`. |
| 1005 |
|
| 1006 |
`OPTIONS`: |
| 1007 |
A dictionary containing additional options for configuring the completion. |
| 1008 |
|
| 1009 |
- `path`: |
| 1010 |
Override the default `$PATH` used for searching executables. |
| 1011 |
|
| 1012 |
- `path_append`: |
| 1013 |
Append directories to the default `$PATH`. |
| 1014 |
|
| 1015 |
- `path_prepend`: |
| 1016 |
Prepend directories to the default `$PATH`. |
| 1017 |
notes: |
| 1018 |
- '`path_append` and `path_prepend` can be used together, but both are mutually exclusive with `path`.' |
| 1019 |
also: |
| 1020 |
command_arg: 'For completing arguments of a command' |
| 1021 |
commandline_string: 'For completing command lines as strings' |
| 1022 |
definition: | |
| 1023 |
prog: 'example' |
| 1024 |
options: |
| 1025 |
- option_strings: ['--command'] |
| 1026 |
complete: ['command'] |
| 1027 |
|
| 1028 |
- option_strings: ['--command-sbin'] |
| 1029 |
complete: ['command', {'path_append': '/sbin:/usr/sbin'}] |
| 1030 |
output: | |
| 1031 |
~ > example --command=bas<TAB> |
| 1032 |
base32 base64 basename basenc bash bashbug |
| 1033 |
|
| 1034 |
--- |
| 1035 |
|
| 1036 |
command: 'command_arg' |
| 1037 |
category: 'basic' |
| 1038 |
short: 'Complete command arguments' |
| 1039 |
notes: |
| 1040 |
- 'This completer can only be used in combination with a previously defined `command` completer.' |
| 1041 |
- 'This completer requires `repeatable: true`.' |
| 1042 |
also: |
| 1043 |
command: 'For completing command names' |
| 1044 |
commandline_string: 'For completing command lines as strings' |
| 1045 |
definition: | |
| 1046 |
prog: 'example' |
| 1047 |
positionals: |
| 1048 |
- number: 1 |
| 1049 |
complete: ['command'] |
| 1050 |
|
| 1051 |
- number: 2 |
| 1052 |
complete: ['command_arg'] |
| 1053 |
repeatable: true |
| 1054 |
output: | |
| 1055 |
~ > example sudo bas<TAB> |
| 1056 |
base32 base64 basename basenc bash bashbug |
| 1057 |
|
| 1058 |
--- |
| 1059 |
|
| 1060 |
command: 'commandline_string' |
| 1061 |
category: 'basic' |
| 1062 |
short: 'Complete command lines as strings' |
| 1063 |
also: |
| 1064 |
command: 'For completing command names' |
| 1065 |
command_arg: 'For completing command arguments' |
| 1066 |
definition: | |
| 1067 |
prog: 'example' |
| 1068 |
options: |
| 1069 |
- option_strings: ['--commandline'] |
| 1070 |
complete: ['commandline_string'] |
| 1071 |
output: | |
| 1072 |
~ > example --commandline='sudo ba<TAB> |
| 1073 |
base32 base64 basename basenc bash bashbug |
| 1074 |
|
| 1075 |
--- |
| 1076 |
|
| 1077 |
command: 'user' |
| 1078 |
category: 'basic' |
| 1079 |
short: 'Complete user names' |
| 1080 |
also: |
| 1081 |
uid: 'For completing user IDs' |
| 1082 |
definition: | |
| 1083 |
prog: 'example' |
| 1084 |
options: |
| 1085 |
- option_strings: ['--user'] |
| 1086 |
complete: ['user'] |
| 1087 |
output: | |
| 1088 |
~ > example --user=<TAB> |
| 1089 |
avahi bin braph |
| 1090 |
colord daemon dbus |
| 1091 |
dhcpcd ftp git |
| 1092 |
[...] |
| 1093 |
|
| 1094 |
--- |
| 1095 |
|
| 1096 |
command: 'group' |
| 1097 |
category: 'basic' |
| 1098 |
short: 'Complete group names' |
| 1099 |
also: |
| 1100 |
gid: 'For completing group IDs' |
| 1101 |
definition: | |
| 1102 |
prog: 'example' |
| 1103 |
options: |
| 1104 |
- option_strings: ['--group'] |
| 1105 |
complete: ['group'] |
| 1106 |
output: | |
| 1107 |
~ > example --group=<TAB> |
| 1108 |
adm audio avahi |
| 1109 |
bin braph colord |
| 1110 |
daemon dbus dhcpcd |
| 1111 |
disk floppy ftp |
| 1112 |
games git groups |
| 1113 |
[...] |
| 1114 |
|
| 1115 |
--- |
| 1116 |
|
| 1117 |
command: 'uid' |
| 1118 |
category: 'basic' |
| 1119 |
short: 'Complete user IDs' |
| 1120 |
also: |
| 1121 |
user: 'For completing user names' |
| 1122 |
definition: | |
| 1123 |
prog: 'example' |
| 1124 |
options: |
| 1125 |
- option_strings: ['--uid'] |
| 1126 |
complete: ['uid'] |
| 1127 |
output: | |
| 1128 |
~ > example --uid=<TAB> |
| 1129 |
0 -- root |
| 1130 |
1000 -- braph |
| 1131 |
102 -- polkitd |
| 1132 |
133 -- rtkit |
| 1133 |
14 -- ftp |
| 1134 |
1 -- bin |
| 1135 |
2 -- daemon |
| 1136 |
33 -- http |
| 1137 |
65534 -- nobody |
| 1138 |
[...] |
| 1139 |
|
| 1140 |
--- |
| 1141 |
|
| 1142 |
command: 'gid' |
| 1143 |
category: 'basic' |
| 1144 |
short: 'Complete group IDs' |
| 1145 |
also: |
| 1146 |
group: 'For completing group names' |
| 1147 |
definition: | |
| 1148 |
prog: 'example' |
| 1149 |
options: |
| 1150 |
- option_strings: ['--gid'] |
| 1151 |
complete: ['gid'] |
| 1152 |
output: | |
| 1153 |
~ > example --gid=<TAB> |
| 1154 |
0 -- root |
| 1155 |
1000 -- braph |
| 1156 |
102 -- polkitd |
| 1157 |
108 -- vboxusers |
| 1158 |
11 -- ftp |
| 1159 |
12 -- mail |
| 1160 |
133 -- rtkit |
| 1161 |
19 -- log |
| 1162 |
[...] |
| 1163 |
|
| 1164 |
--- |
| 1165 |
|
| 1166 |
command: 'service' |
| 1167 |
category: 'basic' |
| 1168 |
short: 'Complete systemd service names' |
| 1169 |
definition: | |
| 1170 |
prog: 'example' |
| 1171 |
options: |
| 1172 |
- option_strings: ['--service'] |
| 1173 |
complete: ['service'] |
| 1174 |
output: | |
| 1175 |
~ > example --service=<TAB> |
| 1176 |
TODO |
| 1177 |
[...] |
| 1178 |
|
| 1179 |
--- |
| 1180 |
|
| 1181 |
command: 'variable' |
| 1182 |
category: 'basic' |
| 1183 |
short: 'Complete shell variable names' |
| 1184 |
also: |
| 1185 |
environment: 'For completing environment variable names' |
| 1186 |
definition: | |
| 1187 |
prog: 'example' |
| 1188 |
options: |
| 1189 |
- option_strings: ['--variable'] |
| 1190 |
complete: ['variable'] |
| 1191 |
output: | |
| 1192 |
~ > example --variable=HO<TAB> |
| 1193 |
HOME HOSTNAME HOSTTYPE |
| 1194 |
|
| 1195 |
--- |
| 1196 |
|
| 1197 |
command: 'environment' |
| 1198 |
category: 'basic' |
| 1199 |
short: 'Complete environment variable names' |
| 1200 |
also: |
| 1201 |
variable: 'For completing shell variable names' |
| 1202 |
definition: | |
| 1203 |
prog: 'example' |
| 1204 |
options: |
| 1205 |
- option_strings: ['--environment'] |
| 1206 |
complete: ['environment'] |
| 1207 |
output: | |
| 1208 |
~ > example --environment=X<TAB> |
| 1209 |
XDG_RUNTIME_DIR XDG_SEAT XDG_SESSION_CLASS XDG_SESSION_ID |
| 1210 |
XDG_SESSION_TYPE XDG_VTNR |
| 1211 |
|
| 1212 |
--- |
| 1213 |
|
| 1214 |
command: 'history' |
| 1215 |
category: 'basic' |
| 1216 |
synopsis: | |
| 1217 |
['history', <REGEX>] |
| 1218 |
short: "Complete based on a shell's history" |
| 1219 |
long: | |
| 1220 |
`REGEX`: |
| 1221 |
An extended regular expression used to filter history entries. |
| 1222 |
The regular expression is passed to `grep -E`. |
| 1223 |
definition: | |
| 1224 |
prog: 'example' |
| 1225 |
options: |
| 1226 |
- option_strings: ['--history'] |
| 1227 |
complete: ['history', '[a-zA-Z0-9]+@[a-zA-Z0-9]+'] |
| 1228 |
output: | |
| 1229 |
~ > example --history=<TAB> |
| 1230 |
foo@bar mymail@myprovider |
| 1231 |
|
| 1232 |
--- |
| 1233 |
|
| 1234 |
command: 'date' |
| 1235 |
category: 'basic' |
| 1236 |
synopsis: | |
| 1237 |
['date', <FORMAT>] |
| 1238 |
short: 'Complete date strings' |
| 1239 |
long: | |
| 1240 |
`FORMAT`: |
| 1241 |
The date format as described in `strftime(3)`. |
| 1242 |
also: |
| 1243 |
date_format: 'For completing date format strings' |
| 1244 |
implemented: ['Zsh'] |
| 1245 |
definition: | |
| 1246 |
prog: 'example' |
| 1247 |
options: |
| 1248 |
- option_strings: ['--date'] |
| 1249 |
complete: ['date', '%Y-%m-%d'] |
| 1250 |
output: | |
| 1251 |
~ > example --date=<TAB> |
| 1252 |
|
| 1253 |
November |
| 1254 |
Mo Tu We Th Fr Sa Su |
| 1255 |
1 2 3 4 5 6 |
| 1256 |
7 8 9 10 11 12 13 |
| 1257 |
14 15 16 17 18 19 20 |
| 1258 |
21 22 23 24 25 26 27 |
| 1259 |
28 29 30 |
| 1260 |
|
| 1261 |
--- |
| 1262 |
|
| 1263 |
command: 'date_format' |
| 1264 |
category: 'basic' |
| 1265 |
short: 'Complete date format strings' |
| 1266 |
also: |
| 1267 |
date: 'For completing dates' |
| 1268 |
implemented: ['Fish', 'Zsh'] |
| 1269 |
definition: | |
| 1270 |
prog: 'example' |
| 1271 |
options: |
| 1272 |
- option_strings: ['--date-format'] |
| 1273 |
complete: ['date_format'] |
| 1274 |
output: | |
| 1275 |
~ > example --date-format '%<TAB> |
| 1276 |
a -- abbreviated day name |
| 1277 |
A -- full day name |
| 1278 |
B -- full month name |
| 1279 |
c -- preferred locale date and time |
| 1280 |
C -- 2-digit century |
| 1281 |
d -- day of month (01-31) |
| 1282 |
D -- American format month/day/year (%m/%d/%y) |
| 1283 |
e -- day of month ( 1-31) |
| 1284 |
[...] |
| 1285 |
|
| 1286 |
--- |
| 1287 |
|
| 1288 |
command: 'ip_address' |
| 1289 |
category: 'basic' |
| 1290 |
synopsis: | |
| 1291 |
['ip_address', <TYPE>] |
| 1292 |
short: 'Complete local IP addresses' |
| 1293 |
long: | |
| 1294 |
`TYPE`: |
| 1295 |
The type of ip addresses to complete: |
| 1296 |
|
| 1297 |
- `ipv4`: IPv4 addresses |
| 1298 |
- `ipv6`: IPv6 addresses |
| 1299 |
- `all`: Both IPv4 and IPv6 addresses |
| 1300 |
|
| 1301 |
Append `+` to include the unspecified address of the selected family: |
| 1302 |
|
| 1303 |
- `ipv4+`: Includes `0.0.0.0` |
| 1304 |
- `ipv6+`: Includes `::` |
| 1305 |
- `all+`: Includes both 0.0.0.0 and `::` |
| 1306 |
also: |
| 1307 |
net_interface: 'For completing network interfaces' |
| 1308 |
hostname: 'For completing hostnames' |
| 1309 |
definition: | |
| 1310 |
prog: 'example' |
| 1311 |
options: |
| 1312 |
- option_strings: ['--ip-address'] |
| 1313 |
complete: ['ip_address'] |
| 1314 |
|
| 1315 |
- option_strings: ['--ip-address-v4'] |
| 1316 |
complete: ['ip_address', 'ipv4'] |
| 1317 |
|
| 1318 |
- option_strings: ['--ip-address-v6'] |
| 1319 |
complete: ['ip_address', 'ipv6'] |
| 1320 |
output: | |
| 1321 |
~ > example --ip-address=<TAB> |
| 1322 |
::1 10.0.0.71 127.0.0.1 fe80::f567:7a1a:3c98:808d |
| 1323 |
|
| 1324 |
~ > example --ip-address-v4=<TAB> |
| 1325 |
10.0.0.71 127.0.0.1 |
| 1326 |
|
| 1327 |
~ > example --ip-address-v6=<TAB> |
| 1328 |
::1 fe80::f567:7a1a:3c98:808d |
| 1329 |
|
| 1330 |
--- |
| 1331 |
|
| 1332 |
command: 'net_interface' |
| 1333 |
category: 'bonus' |
| 1334 |
short: 'Complete network interfaces' |
| 1335 |
also: |
| 1336 |
ip_address: 'For completing IP addresses' |
| 1337 |
definition: | |
| 1338 |
prog: 'example' |
| 1339 |
options: |
| 1340 |
- option_strings: ['--net-interface'] |
| 1341 |
complete: ['net_interface'] |
| 1342 |
output: | |
| 1343 |
~ > example --net-interface=<TAB> |
| 1344 |
eno1 enp1s0 lo wlo1 wlp2s0 |
| 1345 |
[...] |
| 1346 |
|
| 1347 |
--- |
| 1348 |
|
| 1349 |
command: 'mountpoint' |
| 1350 |
category: 'bonus' |
| 1351 |
short: 'Complete mount points' |
| 1352 |
definition: | |
| 1353 |
prog: 'example' |
| 1354 |
options: |
| 1355 |
- option_strings: ['--mountpoint'] |
| 1356 |
complete: ['mountpoint'] |
| 1357 |
output: | |
| 1358 |
~ > example --mountpoint=<TAB> |
| 1359 |
/ /boot /home /proc /run /sys /tmp |
| 1360 |
[...] |
| 1361 |
|
| 1362 |
--- |
| 1363 |
|
| 1364 |
command: 'login_shell' |
| 1365 |
category: 'bonus' |
| 1366 |
short: 'Complete login shells' |
| 1367 |
definition: | |
| 1368 |
prog: 'example' |
| 1369 |
options: |
| 1370 |
- option_strings: ['--login-shell'] |
| 1371 |
complete: ['login_shell'] |
| 1372 |
output: | |
| 1373 |
~ > example --login-shell=<TAB> |
| 1374 |
/bin/bash /bin/sh /usr/bin/fish /usr/bin/sh |
| 1375 |
[...] |
| 1376 |
|
| 1377 |
--- |
| 1378 |
|
| 1379 |
command: 'charset' |
| 1380 |
category: 'bonus' |
| 1381 |
short: 'Complete character sets' |
| 1382 |
definition: | |
| 1383 |
prog: 'example' |
| 1384 |
options: |
| 1385 |
- option_strings: ['--charset'] |
| 1386 |
complete: ['charset'] |
| 1387 |
output: | |
| 1388 |
~ > example --charset=A<TAB> |
| 1389 |
ANSI_X3.110-1983 ANSI_X3.4-1968 ARMSCII-8 ASMO_449 |
| 1390 |
|
| 1391 |
--- |
| 1392 |
|
| 1393 |
command: 'locale' |
| 1394 |
category: 'bonus' |
| 1395 |
short: 'Complete locales' |
| 1396 |
definition: | |
| 1397 |
prog: 'example' |
| 1398 |
options: |
| 1399 |
- option_strings: ['--locale'] |
| 1400 |
complete: ['locale'] |
| 1401 |
output: | |
| 1402 |
~ > example --locale=<TAB> |
| 1403 |
C C.UTF-8 de_DE de_DE@euro de_DE.iso88591 de_DE.iso885915@euro |
| 1404 |
de_DE.UTF-8 deutsch en_US en_US.iso88591 en_US.UTF-8 german POSIX |
| 1405 |
|
| 1406 |
--- |
| 1407 |
|
| 1408 |
command: 'timezone' |
| 1409 |
category: 'bonus' |
| 1410 |
short: 'Complete timezones' |
| 1411 |
definition: | |
| 1412 |
prog: 'example' |
| 1413 |
options: |
| 1414 |
- option_strings: ['--timezone'] |
| 1415 |
complete: ['timezone'] |
| 1416 |
output: | |
| 1417 |
~ > example --timezone=Europe/B<TAB> |
| 1418 |
Belfast Belgrade Berlin Bratislava |
| 1419 |
Brussels Bucharest Budapest Busingen |
| 1420 |
|
| 1421 |
--- |
| 1422 |
|
| 1423 |
command: 'alsa_card' |
| 1424 |
category: 'bonus' |
| 1425 |
short: 'Complete ALSA cards' |
| 1426 |
also: |
| 1427 |
alsa_device: 'For completing ALSA devices' |
| 1428 |
definition: | |
| 1429 |
prog: 'example' |
| 1430 |
options: |
| 1431 |
- option_strings: ['--alsa-card'] |
| 1432 |
complete: ['alsa_card'] |
| 1433 |
output: | |
| 1434 |
~ > example --alsa-card=<TAB> |
| 1435 |
0 1 |
| 1436 |
|
| 1437 |
--- |
| 1438 |
|
| 1439 |
command: 'alsa_device' |
| 1440 |
category: 'bonus' |
| 1441 |
short: 'Complete ALSA devices' |
| 1442 |
also: |
| 1443 |
alsa_card: 'For completing ALSA cards' |
| 1444 |
definition: | |
| 1445 |
prog: 'example' |
| 1446 |
options: |
| 1447 |
- option_strings: ['--alsa-device'] |
| 1448 |
complete: ['alsa_device'] |
| 1449 |
output: | |
| 1450 |
~ > example --alsa-device=<TAB> |
| 1451 |
hw:0 hw:1 |