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 ////////////////////////////////////////////////////////////////////////////////
6 // Default value: LLDB_OPT_SET_ALL (Option allowed in all groups)
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 ////////////////////////////////////////////////////////////////////////////////
17 // Default value: false (Not required)
19 // - `Required`: Marks the option as required.
20 // Example: def foo : Option<"foo", "f">, Required;
21 ////////////////////////////////////////////////////////////////////////////////
23 // Default value: not available (has to be defined in Option)
25 // - `Option` constructor: Already set by constructor.
26 // Example: def foo : Option<"long-option", "l">
29 ////////////////////////////////////////////////////////////////////////////////
30 // Field: short_option
31 // Default value: not available (has to be defined in Option)
33 // - `Option` constructor: Already set by constructor.
34 // Example: def foo : Option<"long-option", "l">
37 ////////////////////////////////////////////////////////////////////////////////
38 // Field: option_has_arg
39 // Default value: OptionParser::eNoArgument (No argument allowed)
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 ////////////////////////////////////////////////////////////////////////////////
48 // Default value: 0 (No validator for option)
50 // - `Validator`: Sets the value to a given validator (which has to exist in
51 // the surrounding code.
52 ////////////////////////////////////////////////////////////////////////////////
54 // Default value: {} (No enum associated with this option)
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)
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
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
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 ////////////////////////////////////////////////////////////////////////////////
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.".
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".
113 // Moves the option into a list of option groups.
114 class Groups<list<int> groups> {
115 list<int> Groups = groups;
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;
124 // Moves the option in a single option group.
125 class Group<int group> {
126 int GroupStart = group;
127 int GroupEnd = group;
130 // Sets the description for the option that should be
131 // displayed to the user.
132 class Desc<string description> {
133 string Description = description;
136 // Marks the option as required when calling the
137 // associated command.
142 // Gives the option an optional argument.
143 class OptionalArg<string type> {
144 string ArgType = type;
148 // Gives the option an required argument.
149 class Arg<string type> {
150 string ArgType = type;
153 // Gives the option an required argument.
154 class EnumArg<string type> {
155 string ArgType = type;
158 // Gives the option an required argument.
159 class OptionalEnumArg<string type> {
160 string ArgType = type;
164 // Sets the available completions for the given option.
165 class Completions<list<string> completions> {
166 list<string> Completions = completions;
168 // Sets a single completion for the given option.
169 class Completion<string completion> {
170 list<string> Completions = [completion];
173 // Sets the validator for a given option.
174 class Validator<string validator> {
175 string Validator = validator;