File: commands.md

package info (click to toggle)
crazy-complete 0.3.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,528 kB
  • sloc: python: 13,342; sh: 995; makefile: 68
file content (1364 lines) | stat: -rw-r--r-- 29,360 bytes parent folder | download
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
### Meta commands

| Command                             | Description                                               |
| ----------------------------------- | --------------------------------------------------------- |
| [combine](#combine)                 | Combine multiple completers                               |
| [key\_value\_list](#key_value_list) | Complete a comma-separated list of key=value pairs        |
| [list](#list)                       | Complete a comma-separated list of any completer          |
| [none](#none)                       | No completion, but specifies that an argument is required |
| [prefix](#prefix)                   | Prefix completion by a string                             |

---

### Built-in commands

| Command                                    | Description                                    |
| ------------------------------------------ | ---------------------------------------------- |
| [choices](#choices)                        | Complete from a set of words                   |
| [command](#command)                        | Complete a command                             |
| [command\_arg](#command_arg)               | Complete arguments of a command                |
| [commandline\_string](#commandline_string) | Complete a command line as a string            |
| [date](#date)                              | Complete a date string                         |
| [date\_format](#date_format)               | Complete a date format string                  |
| [directory](#directory)                    | Complete a directory                           |
| [directory\_list](#directory_list)         | Complete a comma-separated list of directories |
| [environment](#environment)                | Complete a shell environment variable name     |
| [file](#file)                              | Complete a file                                |
| [file\_list](#file_list)                   | Complete a comma-separated list of files       |
| [filesystem\_type](#filesystem_type)       | Complete a filesystem type                     |
| [float](#float)                            | Complete a floating point number               |
| [gid](#gid)                                | Complete a group id                            |
| [group](#group)                            | Complete a group                               |
| [history](#history)                        | Complete based on a shell's history            |
| [hostname](#hostname)                      | Complete a hostname                            |
| [integer](#integer)                        | Complete an integer                            |
| [ip\_address](#ip_address)                 | Complete a bound ip address                    |
| [mime\_file](#mime_file)                   | Complete a file based on it's MIME-type        |
| [pid](#pid)                                | Complete a PID                                 |
| [process](#process)                        | Complete a process name                        |
| [range](#range)                            | Complete a range of integers                   |
| [service](#service)                        | Complete a SystemD service                     |
| [signal](#signal)                          | Complete signal names                          |
| [uid](#uid)                                | Complete a user id                             |
| [user](#user)                              | Complete a username                            |
| [value\_list](#value_list)                 | Complete a comma-separated list of values      |
| [variable](#variable)                      | Complete a shell variable name                 |

---

### User-defined commands

| Command                          | Description                                                                 |
| -------------------------------- | --------------------------------------------------------------------------- |
| [exec](#exec)                    | Complete by the output of a command or function                             |
| [exec\_fast](#exec_fast)         | Complete by the output of a command or function (fast and unsafe)           |
| [exec\_internal](#exec_internal) | Complete by a function that uses the shell's internal completion mechanisms |

---

### Bonus commands

| Command                          | Description                  |
| -------------------------------- | ---------------------------- |
| [alsa\_card](#alsa_card)         | Complete an ALSA card        |
| [alsa\_device](#alsa_device)     | Complete an ALSA device      |
| [charset](#charset)              | Complete a charset           |
| [locale](#locale)                | Complete a locale            |
| [login\_shell](#login_shell)     | Complete a login shell       |
| [mountpoint](#mountpoint)        | Complete a mountpoint        |
| [net\_interface](#net_interface) | Complete a network interface |
| [timezone](#timezone)            | Complete a timezone          |

---

### alsa\_card

> Complete an ALSA card

```yaml
prog: "example"
options:
  - option_strings: ["--alsa-card"]
    complete: ["alsa_card"]
```

```
~ > example --alsa-card=<TAB>
0  1
```

**SEE ALSO**

- [alsa\_device](#alsa_device): For completing an ALSA device

---

### alsa\_device

> Complete an ALSA device

```yaml
prog: "example"
options:
  - option_strings: ["--alsa-device"]
    complete: ["alsa_device"]
```

```
~ > example --alsa-device=<TAB>
hw:0  hw:1
```

**SEE ALSO**

- [alsa\_card](#alsa_card): For completing an ALSA card

---

### charset

> Complete a charset

```yaml
prog: "example"
options:
  - option_strings: ["--charset"]
    complete: ["charset"]
```

```
~ > example --charset=A<TAB>
ANSI_X3.110-1983  ANSI_X3.4-1968    ARMSCII-8         ASMO_449
```

---

### locale

> Complete a locale

```yaml
prog: "example"
options:
  - option_strings: ["--locale"]
    complete: ["locale"]
```

```
~ > example --locale=<TAB>
C  C.UTF-8  de_DE  de_DE@euro  de_DE.iso88591  de_DE.iso885915@euro
de_DE.UTF-8  deutsch  en_US  en_US.iso88591  en_US.UTF-8  german  POSIX
```

---

### login\_shell

> Complete a login shell

```yaml
prog: "example"
options:
  - option_strings: ["--login-shell"]
    complete: ["login_shell"]
```

```
~ > example --login-shell=<TAB>
/bin/bash   /bin/sh         /usr/bin/fish       /usr/bin/sh
[...]
```

---

### mountpoint

> Complete a mountpoint

```yaml
prog: "example"
options:
  - option_strings: ["--mountpoint"]
    complete: ["mountpoint"]
```

```
~ > example --mountpoint=<TAB>
/  /boot  /home  /proc  /run  /sys  /tmp
[...]
```

---

### net\_interface

> Complete a network interface

```yaml
prog: "example"
options:
  - option_strings: ["--net-interface"]
    complete: ["net_interface"]
```

```
~ > example --net-interface=<TAB>
eno1  enp1s0  lo  wlo1  wlp2s0
[...]
```

**SEE ALSO**

- [ip\_address](#ip_address): For completing an ip address

---

### timezone

> Complete a timezone

```yaml
prog: "example"
options:
  - option_strings: ["--timezone"]
    complete: ["timezone"]
```

```
~ > example --timezone=Europe/B<TAB>
Belfast     Belgrade    Berlin      Bratislava
Brussels    Bucharest   Budapest    Busingen
```

---

### choices

> Complete from a set of words

Items can be a list or a dictionary.
 
If a dictionary is supplied, the keys are used as items and the values are used
as description.


**NOTES**

- If the completion suggestions should appear in their original order, set `nosort` to `true`

```yaml
prog: "example"
options:
  - option_strings: ["--choices-1"]
    complete: ["choices", ["Item 1", "Item 2"]]

  - option_strings: ["--choices-2"]
    complete: ["choices", {"Item 1": "Description 1", "Item 2": "Description 2"}]

  - option_strings: ["--choices-keep-order"]
    complete: ["choices", ["zebra", "cat", "monkey"]]
    nosort: true
```

```
~ > example --choices-2=<TAB>
Item 1  (Description 1)  Item 2  (Description 2)
```

---

### command

> Complete a command

This completer provides completion suggestions for executable commands available in the system's `$PATH`.
 
`$PATH` can be modified using these options:
 
`{"path": "<directory>:..."}`: Overrides the default `$PATH` entirely.
 
`{"path_append": "<directory>:..."}`: Appends to the default `$PATH`.
 
`{"path_prepend": "<directory>:..."}`: Prepends to the default `$PATH`.


**NOTES**

- `path_append` and `path_prepend` can be used together, but both are mutually exclusive with `path`.

```yaml
prog: "example"
options:
  - option_strings: ["--command"]
    complete: ["command"]
  - option_strings: ["--command-sbin"]
    complete: ["command", {"path_append": "/sbin:/usr/sbin"}]
```

```
~ > example --command=bas<TAB>
base32    base64    basename  basenc    bash      bashbug
```

**SEE ALSO**

- [command\_arg](#command_arg): For completing arguments of a command

- [commandline\_string](#commandline_string): For completing a command line as a string

---

### command\_arg

> Complete arguments of a command

**NOTES**

- This completer can only be used in combination with a previously defined `command` completer.

- This completer requires `repeatable: true`.

```yaml
prog: "example"
positionals:
  - number: 1
    complete: ["command"]

  - number: 2
    complete: ["command_arg"]
    repeatable: true
```

```
~ > example sudo bas<TAB>
base32    base64    basename  basenc    bash      bashbug
```

**SEE ALSO**

- [command](#command): For completing a command

- [commandline\_string](#commandline_string): For completing a command line as a string

---

### commandline\_string

> Complete a command line as a string

```yaml
prog: "example"
options:
  - option_strings: ["--commandline"]
    complete: ["commandline_string"]
```

```
~ > example --commandline='sudo ba<TAB>
base32    base64    basename  basenc    bash      bashbug
```

---

### date

> Complete a date string

The argument is the date format as described in `strftime(3)`.


**NOTES**

- This completer is currently only implemented in **Zsh**.

```yaml
prog: "example"
options:
  - option_strings: ["--date"]
    complete: ["date", '%Y-%m-%d']
```

```
~ > example --date=<TAB>

         November                        
Mo  Tu  We  Th  Fr  Sa  Su     
     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
```

**SEE ALSO**

- [date\_format](#date_format): For completing a date format string

---

### date\_format

> Complete a date format string

**NOTES**

- This completer is currently only implemented in **Fish** and **Zsh**.

```yaml
prog: "example"
options:
  - option_strings: ["--date-format"]
    complete: ["date_format"]
```

```
~ > example --date-format '%<TAB>
a     -- abbreviated day name
A     -- full day name
B     -- full month name
c     -- preferred locale date and time
C     -- 2-digit century
d     -- day of month (01-31)
D     -- American format month/day/year (%m/%d/%y)
e     -- day of month ( 1-31)
[...]
```

**SEE ALSO**

- [date](#date): For completing a date

---

### directory

> Complete a directory

You can restrict completion to a specific directory by adding `{"directory": ...}`.


```yaml
prog: "example"
options:
  - option_strings: ["--directory"]
    complete: ["directory"]
  - option_strings: ["--directory-tmp"]
    complete: ["directory", {"directory": "/tmp"}]
```

```
~ > example --directory=<TAB>
dir1/  dir2/
```

**SEE ALSO**

- [directory\_list](#directory_list): For completing a comma-separated list of directories

---

### directory\_list

> Complete a comma-separated list of directories

This is an alias for `['list', ['directory']]`.

You can restrict completion to a specific directory by adding `{"directory": ...}`.
 
The separator can be changed by adding `{"separator": ...}`
 
By default, duplicate values are not offered for completion. This can be changed by adding `{"duplicates": true}`.


```yaml
prog: "example"
options:
  - option_strings: ["--directory-list"]
    complete: ["directory_list"]
```

```
~ > example --directory-list=directory1,directory2,<TAB>
directory3  directory4
```

**SEE ALSO**

- [list](#list): For completion a comma-separated list of any completer

- [directory](#directory): For completing a directory

- [file\_list](#file_list): For completing a comma-separated list of files

---

### environment

> Complete a shell environment variable name

```yaml
prog: "example"
options:
  - option_strings: ["--environment"]
    complete: ["environment"]
```

```
~ > example --environment=X<TAB>
XDG_RUNTIME_DIR  XDG_SEAT  XDG_SESSION_CLASS  XDG_SESSION_ID
XDG_SESSION_TYPE XDG_VTNR
```

---

### file

> Complete a file

You can restrict completion to a specific directory by adding `{"directory": ...}`.
 
You can restrict completion to specific extensions by adding `{"extensions": [...]}`.
 
You can make matching extensions *fuzzy* by adding `{"fuzzy": true}`.
Fuzzy means that the files do not have to end with the exact extension. For example `foo.txt.1`.

You can ignore files by adding a list of Bash globs using `{"ignore_globs": [...]}`

**NOTE:** Restricting completion to specific file extensions only makes sense if the program being completed actually expects files of those types.
On Unix-like systems, file extensions generally have no inherent meaning -- they are purely conventional and not required for determining file types.


```yaml
prog: "example"
options:
  - option_strings: ["--file"]
    complete: ["file"]

  - option_strings: ["--file-tmp"]
    complete: ["file", {"directory": "/tmp"}]

  - option_strings: ["--file-ext"]
    complete: ["file", {"extensions": ["c", "cpp"]}]

  - option_strings: ["--file-ignore"]
    complete: ["file", {"ignore_globs": ["*.[tT][xX][tT]", "*.c++"]}]
```

```
~ > example --file=<TAB>
dir1/  dir2/  file1  file2
~ > example --file-ext=<TAB>
dir1/  dir2/  file.c  file.cpp
```

**SEE ALSO**

- [file\_list](#file_list): For completing a comma-separated list of files

- [mime\_file](#mime_file): For completing a file based on it's MIME-type

---

### file\_list

> Complete a comma-separated list of files

This is an alias for `['list', ['file']]`.

You can restrict completion to a specific directory by adding `{"directory": ...}`.

You can restrict completion to specific extensions by adding `{"extensions": [...]}`.

You can make matching extensions *fuzzy* by adding `{"fuzzy": true}`.
Fuzzy means that the files do not have to end with the exact extension. For example `foo.txt.1`.

You can ignore files by adding a list of Bash globs using `{"ignore_globs": [...]}`

By default, duplicate values are not offered for completion. This can be changed by adding `{"duplicates": true}`.

The separator can be changed by adding `{"separator": ...}`


```yaml
prog: "example"
options:
  - option_strings: ["--file-list"]
    complete: ["file_list"]
```

```
~ > example --file-list=file1,file2,<TAB>
file3  file4
```

**SEE ALSO**

- [list](#list): For completing a comma-separted list using any completer

- [file](#file): For completing a file

- [directory\_list](#directory_list): For completing a comma-separated list of directories

---

### filesystem\_type

> Complete a filesystem type

```yaml
prog: "example"
options:
  - option_strings: ["--filesystem-type"]
    complete: ["filesystem_type"]
```

```
~ > example --filesystem-type=<TAB>
adfs     autofs   bdev      bfs     binder     binfmt_misc  bpf
cgroup   cgroup2  configfs  cramfs  debugfs    devpts       devtmpfs
[...]
```

---

### float

> Complete a floating point number

A min value can be specified by using `{"min": <VALUE>}`.

A max value can be specified by using `{"max": <VALUE>}`.

A list of suffixes can be specified by using `{"suffixes": {"<SUFFIX>": "<DESCRIPTION", ...}}`

A help text can be set by using `{"help": "<TEXT>"}`. If not supplied, the `help` attribute of the option is used.


```yaml
prog: "example"
options:
  - option_strings: ["--time"]
    complete: ["float", {"suffixes": {"s": "seconds", "m": "minutes", "h": "hours"}}]
```

```
~ > example --time=3.0<TAB>
s -- seconds  m -- minutes  h -- hours
```

**SEE ALSO**

- [integer](#integer): For completing an integer

---

### gid

> Complete a group id

```yaml
prog: "example"
options:
  - option_strings: ["--gid"]
    complete: ["gid"]
```

```
~ > example --gid=<TAB>
0      -- root
1000   -- braph
102    -- polkitd
108    -- vboxusers
11     -- ftp
12     -- mail
133    -- rtkit
19     -- log
[...]
```

**SEE ALSO**

- [group](#group): For completing a group name

---

### group

> Complete a group

```yaml
prog: "example"
options:
  - option_strings: ["--group"]
    complete: ["group"]
```

```
~ > example --group=<TAB>
adm                     audio                   avahi
bin                     braph                   colord
daemon                  dbus                    dhcpcd
disk                    floppy                  ftp
games                   git                     groups
[...]
```

**SEE ALSO**

- [gid](#gid): For completing a group id

---

### history

> Complete based on a shell's history

The argument is an extended regular expression passed to `grep -E`.


```yaml
prog: "example"
options:
  - option_strings: ["--history"]
    complete: ["history", '[a-zA-Z0-9]+@[a-zA-Z0-9]+']
```

```
~ > example --history=<TAB>
foo@bar mymail@myprovider
```

---

### hostname

> Complete a hostname

```yaml
prog: "example"
options:
  - option_strings: ["--hostname"]
    complete: ["hostname"]
```

```
~ > example --hostname=<TAB>
localhost
```

---

### integer

> Complete an integer

A min value can be specified by using `{"min": <VALUE>}`.

A max value can be specified by using `{"max": <VALUE>}`.

A list of suffixes can be specified by using `{"suffixes": {"<SUFFIX>": "<DESCRIPTION", ...}}`

A help text can be set by using `{"help": "<TEXT>"}`. If not supplied, the `help` attribute of the option is used.


```yaml
prog: "example"
options:
  - option_strings: ["--time"]
    complete: ["integer", {"suffixes": {"s": "seconds", "m": "minutes", "h": "hours"}}]
```

```
~ > example --integer=3<TAB>
s -- seconds  m -- minutes  h -- hours
```

**SEE ALSO**

- [float](#float): For completing a floating point number

- [range](#range): For completing a range of integers

---

### ip\_address

> Complete a bound ip address

By default, both IPv4 and IPv6 addresses are completed.

To complete only IPv4 addresses, pass "ipv4" as argument.

To complete only IPv6 addresses, pass "ipv6" as argument.


```yaml
prog: "example"
options:
  - option_strings: ["--ip-address"]
    complete: ["ip_address"]
  - option_strings: ["--ip-address-v4"]
    complete: ["ip_address", "ipv4"]
  - option_strings: ["--ip-address-v6"]
    complete: ["ip_address", "ipv6"]
```

```
~ > example --ip-address=<TAB>
::1    10.0.0.71   127.0.0.1   fe80::f567:7a1a:3c98:808d

~ > example --ip-address-v4=<TAB>
10.0.0.71   127.0.0.1

~ > example --ip-address-v6=<TAB>
::1   fe80::f567:7a1a:3c98:808d
```

**SEE ALSO**

- [net\_interface](#net_interface): For completing a network interface

---

### mime\_file

> Complete a file based on it's MIME-type

This completer takes an extended regex passed to `grep -E` to filter the results.


```yaml
prog: "example"
options:
  - option_strings: ["--image"]
    complete: ["mime_file", 'image/']
```

```
~ > example --image=<TAB>
dir1/  dir2/  img.png  img.jpg
```

---

### pid

> Complete a PID

```yaml
prog: "example"
options:
  - option_strings: ["--pid"]
    complete: ["pid"]
```

```
~ > example --pid=<TAB>
1       13      166     19      254     31      45
1006    133315  166441  19042   26      32      46
10150   1392    166442  195962  27      33      4609
```

**SEE ALSO**

- [process](#process): For completing a process name

---

### process

> Complete a process name

```yaml
prog: "example"
options:
  - option_strings: ["--process"]
    complete: ["process"]
```

```
~ > example --process=s<TAB>
scsi_eh_0         scsi_eh_1       scsi_eh_2      scsi_eh_3  scsi_eh_4
scsi_eh_5         sh              sudo           syndaemon  systemd
systemd-journald  systemd-logind  systemd-udevd
```

**SEE ALSO**

- [pid](#pid): For completing a PID

---

### range

> Complete a range of integers

```yaml
prog: "example"
options:
  - option_strings: ["--range-1"]
    complete: ["range", 1, 9]
  - option_strings: ["--range-2"]
    complete: ["range", 1, 9, 2]
```

```
~ > example --range-1=<TAB>
1  2  3  4  5  6  7  8  9
~ > example --range-2=<TAB>
1  3  5  7  9
```

---

### service

> Complete a SystemD service

```yaml
prog: "example"
options:
  - option_strings: ["--service"]
    complete: ["service"]
```

```
~ > example --service=<TAB>
TODO
[...]
```

---

### signal

> Complete signal names

```yaml
prog: "example"
options:
  - option_strings: ["--signal"]
    complete: ["signal"]
```

```
~ > example --signal=<TAB>
ABRT    -- Process abort signal
ALRM    -- Alarm clock
BUS     -- Access to an undefined portion of a memory object
CHLD    -- Child process terminated, stopped, or continued
CONT    -- Continue executing, if stopped
FPE     -- Erroneous arithmetic operation
HUP     -- Hangup
ILL     -- Illegal instruction
INT     -- Terminal interrupt signal
[...]
```

---

### uid

> Complete a user id

```yaml
prog: "example"
options:
  - option_strings: ["--uid"]
    complete: ["uid"]
```

```
~ > example --uid=<TAB>
0      -- root
1000   -- braph
102    -- polkitd
133    -- rtkit
14     -- ftp
1      -- bin
2      -- daemon
33     -- http
65534  -- nobody
[...]
```

**SEE ALSO**

- [user](#user): For completing a user name

---

### user

> Complete a username

```yaml
prog: "example"
options:
  - option_strings: ["--user"]
    complete: ["user"]
```

```
~ > example --user=<TAB>
avahi                   bin                     braph
colord                  daemon                  dbus
dhcpcd                  ftp                     git
[...]
```

**SEE ALSO**

- [uid](#uid): For completing a user id

---

### value\_list

> Complete a comma-separated list of values

Complete one or more items from a list of items. Similar to `mount -o`.
 
Arguments are supplied by adding `{"values": ...}`.
 
A separator can be supplied by adding `{"separator": ...}` (the default is `","`).
 
By default, duplicate values are not offered for completion. This can be changed by adding `{"duplicates": true}`.


```yaml
prog: "example"
options:
  - option_strings: ["--value-list-1"]
    complete: ["value_list", {"values": ["exec", "noexec"]}]
  - option_strings: ["--value-list-2"]
    complete: ["value_list", {"values": {"one": "Description 1", "two": "Description 2"}}]
```

```
~ > example --value-list-1=<TAB>
exec    noexec
~ > example --value-list-1=exec,<TAB>
noexec
~ > example --value-list-2=<TAB>
one  -- Description 1
two  -- Description 2
```

**SEE ALSO**

- [list](#list): For completing a comma-separated list of any completer

- [key\_value\_list](#key_value_list): For completing a comma-separated list of key=value pairs

---

### variable

> Complete a shell variable name

```yaml
prog: "example"
options:
  - option_strings: ["--variable"]
    complete: ["variable"]
```

```
~ > example --variable=HO<TAB>
HOME      HOSTNAME  HOSTTYPE
```

**SEE ALSO**

- [environment](#environment): For completing an environment variable

---

### combine

> Combine multiple completers

With `combine` multiple completers can be combined into one.

It takes a list of completers as its argument.


```yaml
prog: "example"
options:
  - option_strings: ["--combine"]
    complete: ["combine", [["user"], ["pid"]]]
```

```
~ > example --user-list=avahi,daemon,<TAB>
1439404  3488332  3571716           3607235                 4134206
alpm     avahi    bin               braph                   daemon
root     rtkit    systemd-coredump  systemd-journal-remote  systemd-network
[...]
```

---

### key\_value\_list

> Complete a comma-separated list of key=value pairs

The first argument is the separator used for delimiting the key-value pairs.

The second argument is the separator used for delimiting the value from the key.

The third argument is a list of key-description-completer definitions, like:

  `[ [<key>, <description>, <completer>], ... ]`

If a key does not take an argument, use `null` as completer.

If a key does take an argument but cannot be completed, use `['none']` as completer.


```yaml
prog: "example"
options:
  - option_strings: ["--key-value-list"]
    complete: ["key_value_list", ",", "=", [
      ['flag',   'An option flag', null],
      ['nodesc', null, null],
      ['nocomp', 'An option with arg but without completer', ['none']],
      ['user',   'Takes a username',  ['user']],
      ['check',  'Specify file name conversions', ['choices', {
        'relaxed': "convert to lowercase before lookup",
        'strict': "no conversion"
      }]]
    ]]
```

```
~ > example --key-value-list flag,user=<TAB>
bin                     braph
colord                  dbus
dhcpcd                  git
```

**SEE ALSO**

- [list](#list): For completing a comma-separated list of any completer

- [value\_list](#value_list): For completing a comma-separated list of values

---

### list

> Complete a comma-separated list of any completer

The separator can be changed by adding `{"separator": ...}`.

By default, duplicate values are not offered for completion. This can be changed by adding `{"duplicates": true}`.


```yaml
prog: "example"
options:
  - option_strings: ["--user-list"]
    complete: ["list", ["user"]]
  - option_strings: ["--option-list"]
    complete: ["list", ["choices", ["setuid", "async", "block"]], {"separator": ":"}]
```

```
~ > example --user-list=avahi,daemon,<TAB>
bin                     braph
colord                  dbus
dhcpcd                  git
```

**SEE ALSO**

- [value\_list](#value_list): For completing a comma-separated list of values

- [file\_list](#file_list): For completing a comma-separated list of files

- [directory\_list](#directory_list): For completing a comma-separated list of directories

- [key\_value\_list](#key_value_list): For completing a comma-separated list of key=value pairs

---

### none

> No completion, but specifies that an argument is required

Disables autocompletion for an option but still marks it as requiring an argument.

Without specifying `complete`, the option would not take an argument.


```yaml
prog: "example"
options:
  - option_strings: ["--none"]
    complete: ["none"]
```

```
~ > example --none=<TAB>
<NO OUTPUT>
```

---

### prefix

> Prefix completion by a string

The first argument is the prefix that should be used.

The second argument is a completer.


```yaml
prog: "example"
options:
  - option_strings: ["--prefix"]
    complete: ["prefix", "input:", ['file']]
```

```
~ > example --prefix=<TAB>
~ > example --prefix=input:

~ > example --prefix=input:<TAB>
~ > example --prefix=input:file1.txt
```

---

### exec

> Complete by the output of a command or function

The output must be in form of:

```
<item_1>\t<description_1>\n
<item_2>\t<description_2>\n
[...]
```

An item and its description are delimited by a tabulator.
 
These pairs are delimited by a newline.


**NOTES**

- Functions can be put inside a file and included with `--include-file`

```yaml
prog: "example"
options:
  - option_strings: ["--exec"]
    complete: ["exec", "printf '%s\\t%s\\n' 'Item 1' 'Description 1' 'Item 2' 'Description 2'"]
```

```
~ > example --exec=<TAB>
Item 1  (Description 1)  Item 2  (Description 2)
```

**SEE ALSO**

- [exec\_fast](#exec_fast): Faster implementation of exec

---

### exec\_fast

> Complete by the output of a command or function (fast and unsafe)

Faster version of exec for handling large amounts of data.
 
This implementation requires that the items of the parsed output do not include
special shell characters or whitespace.


**NOTES**

- Functions can be put inside a file and included with `--include-file`

```yaml
prog: "example"
options:
  - option_strings: ["--exec-fast"]
    complete: ["exec_fast", "printf '%s\\t%s\\n' 1 one 2 two"]
```

```
~ > example --exec-internal=<TAB>
1  -- one
2  -- one
```

---

### exec\_internal

> Complete by a function that uses the shell's internal completion mechanisms

Execute a function that internally modifies the completion state.

This is useful if a more advanced completion is needed.

For **Bash**, it might look like:

```sh
my_completion_func() {
    COMPREPLY=( $(compgen -W "read write append" -- "$cur") )
}
```

For **Zsh**, it might look like:

```sh
my_completion_func() {
    local items=(
        read:'Read data from a file'
        write:'Write data from a file'
        append:'Append data to a file'
    )

    _describe 'my items' items
}
```

For **Fish**, it might look like:

```sh
function my_completion_func
    printf '%s\t%s\n' \
        read 'Read data from a file'  \
        write 'Write data from a file' \
        append 'Append data to a file'
end
```


**NOTES**

- Functions can be put inside a file and included with `--include-file`

```yaml
prog: "example"
options:
  - option_strings: ["--exec-internal"]
    complete: ["exec_internal", "my_completion_func"]
```

```
~ > example --exec-internal=<TAB>
append  -- Append data to a file
read    -- Read data from a file
write   -- Write data from a file
```