]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/source/Commands/OptionsBase.td
Merge OpenSSL 1.1.1g.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / source / Commands / OptionsBase.td
1
2 // The fields below describe how the fields of `OptionDefinition` struct are
3 // initialized by different definitions in the Options.td and this file.
4 ////////////////////////////////////////////////////////////////////////////////
5 // Field: usage_mask
6 // Default value: LLDB_OPT_SET_ALL (Option allowed in all groups)
7 // Set by:
8 //  - `Group`: Sets a single group to this option.
9 //             Example: def foo : Option<"foo", "f">, Group<1>;
10 //  - `Groups`: Sets a given list of group numbers.
11 //              Example: def foo : Option<"foo", "f">, Groups<[1,4,6]>;
12 //  - `GroupRange`: Sets an interval of groups. Start and end are inclusive.
13 //                  Example: def foo : Option<"foo", "f">, GroupRange<1, 4>;
14 //                           Sets group 1, 2, 3, 4 for the option.
15 ////////////////////////////////////////////////////////////////////////////////
16 // Field: required
17 // Default value: false (Not required)
18 // Set by:
19 //   - `Required`: Marks the option as required.
20 //              Example: def foo : Option<"foo", "f">, Required;
21 ////////////////////////////////////////////////////////////////////////////////
22 // Field: long_option
23 // Default value: not available (has to be defined in Option)
24 // Set by:
25 //   - `Option` constructor: Already set by constructor.
26 //                           Example: def foo : Option<"long-option", "l">
27 //                                                           ^
28 //                                                    long option value
29 ////////////////////////////////////////////////////////////////////////////////
30 // Field: short_option
31 // Default value: not available (has to be defined in Option)
32 // Set by:
33 //   - `Option` constructor: Already set by constructor.
34 //                           Example: def foo : Option<"long-option", "l">
35 //                                                                     ^
36 //                                                                short option
37 ////////////////////////////////////////////////////////////////////////////////
38 // Field: option_has_arg
39 // Default value: OptionParser::eNoArgument (No argument allowed)
40 // Set by:
41 //  - `OptionalArg`: Sets the argument type and marks it as optional.
42 //  - `Arg`: Sets the argument type and marks it as required.
43 //  - `EnumArg`: Sets the argument type to an enum and marks it as required.
44 //  - `OptionalEnumArg`: Same as EnumArg but marks it as optional.
45 // See argument_type field for more info.
46 ////////////////////////////////////////////////////////////////////////////////
47 // Field: validator
48 // Default value: 0 (No validator for option)
49 // Set by:
50 //  - `Validator`: Sets the value to a given validator (which has to exist in
51 //                 the surrounding code.
52 ////////////////////////////////////////////////////////////////////////////////
53 // Field: enum_values
54 // Default value: {} (No enum associated with this option)
55 // Set by:
56 //  - `OptionalEnumArg`:
57 //  - `EnumArg`: Sets the argument type and assigns it a enum holding the valid
58 //               values. The enum needs to be a variable in the including code.
59 //               Marks the option as required (see option_has_arg).
60 //               Example: def foo : Option<"foo", "f">,
61 //                          EnumArg<"SortOrder",
62 //                          "OptionEnumValues(g_sort_option_enumeration)">;
63 ////////////////////////////////////////////////////////////////////////////////
64 // Field: completion_type
65 // Default value: CommandCompletions::eNoCompletion (no tab completion)
66 // Set by:
67 //  - `Completion`: Gives the option a single completion kind.
68 //                  Example: def foo : Option<"foo", "f">,
69 //                             Completion<"DiskFile">;
70 //                           Sets the completion to eDiskFileCompletion
71 //
72 //  - `Completions`: Sets a given kinds of completions.
73 //                   Example: def foo : Option<"foo", "f">,
74 //                              Completions<["DiskFile", "DiskDirectory"]>;
75 //                            Sets the completion to
76 //                            `eDiskFileCompletion | eDiskDirectoryCompletion`.
77 ////////////////////////////////////////////////////////////////////////////////
78 // Field: argument_type
79 // Default value: eArgTypeNone
80 // Set by:
81 //  - `OptionalArg`: Sets the argument type and marks it as optional.
82 //                   Example: def foo : Option<"foo", "f">, OptionalArg<"Pid">;
83 //                   Sets the argument type to eArgTypePid and marks option as
84 //                   optional (see option_has_arg).
85 //  - `Arg`: Sets the argument type and marks it as required.
86 //           Example: def foo : Option<"foo", "f">, Arg<"Pid">;
87 //                    Sets the argument type to eArgTypePid and marks option as
88 //                    required (see option_has_arg).
89 //  - `OptionalEnumArg`:
90 //  - `EnumArg`: Sets the argument type and assigns it a enum holding the valid
91 //               values. The enum needs to be a variable in the including code.
92 //               Marks the option as required (see option_has_arg).
93 //               Example: def foo : Option<"foo", "f">,
94 //                          EnumArg<"SortOrder",
95 //                          "OptionEnumValues(g_sort_option_enumeration)">;
96 //               Use `OptionalEnumArg` for having an option enum argument.
97 ////////////////////////////////////////////////////////////////////////////////
98 // Field: usage_text
99 // Default value: ""
100 // Set by:
101 //  - `Desc`: Sets the description for the given option.
102 //            Example: def foo : Option<"foo", "f">, Desc<"does nothing.">;
103 //                     Sets the description to "does nothing.".
104
105 // Base class for all options.
106 class Option<string fullname, string shortname> {
107   string FullName = fullname;
108   string ShortName = shortname;
109   // The full associated command/subcommand such as "settings set".
110   string Command;
111 }
112
113 // Moves the option into a list of option groups.
114 class Groups<list<int> groups> {
115   list<int> Groups = groups;
116 }
117
118 // Moves the option in all option groups in a range.
119 // Start and end values are inclusive.
120 class GroupRange<int start, int end> {
121   int GroupStart = start;
122   int GroupEnd = end;
123 }
124 // Moves the option in a single option group.
125 class Group<int group> {
126   int GroupStart = group;
127   int GroupEnd = group;
128 }
129
130 // Sets the description for the option that should be
131 // displayed to the user.
132 class Desc<string description> {
133   string Description = description;
134 }
135
136 // Marks the option as required when calling the
137 // associated command.
138 class Required {
139   bit Required = 1;
140 }
141
142 // Gives the option an optional argument.
143 class OptionalArg<string type> {
144   string ArgType = type;
145   bit OptionalArg = 1;
146 }
147
148 // Gives the option an required argument.
149 class Arg<string type> {
150   string ArgType = type;
151 }
152
153 // Gives the option an required argument.
154 class EnumArg<string type, string enum> {
155   string ArgType = type;
156   string ArgEnum = enum;
157 }
158
159 // Gives the option an required argument.
160 class OptionalEnumArg<string type, string enum> {
161   string ArgType = type;
162   string ArgEnum = enum;
163   bit OptionalArg = 1;
164 }
165
166 // Sets the available completions for the given option.
167 class Completions<list<string> completions> {
168   list<string> Completions = completions;
169 }
170 // Sets a single completion for the given option.
171 class Completion<string completion> {
172   list<string> Completions = [completion];
173 }
174
175 // Sets the validator for a given option.
176 class Validator<string validator> {
177   string Validator = validator;
178 }