Debian Codegraph @

test/tests/when.yaml

raw
1 prog: "crazy-complete-test"
2 options:
3 - option_strings: ['--option-1']
4
5 - option_strings: ['--option-2']
6
7 - option_strings: ['--if-1-and-2']
8 when: 'has_option --option-1 && has_option --option-2'
9
10 - option_strings: ['--if-1-or-2']
11 when: 'has_option --option-1 || has_option --option-2'
12
13 - option_strings: ['--if-not-1']
14 when: '! has_option --option-1'
15
16 - option_strings: ['--if-not-1-or-not-2']
17 when: '! (has_option --option-1 || has_option --option-2)'
18
19 ---
20
21 prog: "crazy-complete-test positionals"
22 options:
23 - option_strings: ['--if-positional-count']
24 when: 'positional_count >= 2'
25
26 - option_strings: ['--if-positional-contains']
27 when: 'positional_contains 2 foo bar'
28
29 - option_strings: ['--if-positional-contains-nocase']
30 when: 'positional_contains NOCASE 2 foo bar'
31
32 - option_strings: ['--if-positional-regex']
33 when: 'positional_match 2 "reg(ex)?"'
34
35 - option_strings: ['--if-positional-regex-nocase']
36 when: 'positional_match NOCASE 2 "reg(ex)?"'
37
38 ---
39
40 prog: "crazy-complete-test multiple-when"
41 options:
42 - option_strings: ['--files']
43
44 - option_strings: ['--directories']
45
46 - option_strings: ['--complete']
47 complete: ['choices', ['file1', 'file2', 'file3']]
48 when: 'has_option --files'
49
50 - option_strings: ['--complete']
51 complete: ['choices', ['dir1', 'dir2', 'dir3']]
52 when: 'has_option --directories'
53
54 positionals:
55 - number: 1
56 complete: ['choices', ['file1', 'file2', 'file3']]
57 when: 'has_option --files'
58
59 - number: 1
60 complete: ['choices', ['dir1', 'dir2', 'dir3']]
61 when: 'has_option --directories'
62
63 ---
64
65 prog: "crazy-complete-test special-values"
66 options:
67 - option_strings: ['--arg']
68 complete: ['none']
69
70 - option_strings: ['--if-arg-is-foo-bar']
71 when: 'option_is --arg -- "foo bar"'
72
73 - option_strings: ['--if-arg-is-single-quote']
74 when: "option_is --arg -- \"'\""
75
76 - option_strings: ['--if-arg-is-double-quote']
77 when: "option_is --arg -- '\"'"
78
79 ---
80
81 prog: "crazy-complete-test advanced"
82 options:
83 - option_strings: ['--arg']
84 complete: ['none']
85
86 - option_strings: ['--if-arg-is-foo-or-bar-nocase']
87 when: 'option_is NOCASE --arg -- foo bar'
88
89 - option_strings: ['--if-arg-is-regex']
90 when: 'option_match --arg -- "reg(ex)?"'
91
92 - option_strings: ['--if-arg-is-regex-nocase']
93 when: 'option_match NOCASE --arg -- "reg(ex)?"'
94
95 ---
96
97 prog: "crazy-complete-test any"
98 options:
99 - option_strings: ['--arg']
100 complete: ['none']
101
102 - option_strings: ['--if-arg-is-foo']
103 when: 'option_is --arg -- foo'
104
105 - option_strings: ['--if-any-arg-is-foo']
106 when: 'option_is ANY --arg -- foo'
107
108 - option_strings: ['--if-arg-is-regex']
109 when: 'option_match --arg -- "reg(ex)?"'
110
111 - option_strings: ['--if-any-arg-is-regex']
112 when: 'option_match ANY --arg -- "reg(ex)?"'