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 // See argument_type field for more info.
45 ////////////////////////////////////////////////////////////////////////////////
47 // Default value: 0 (No validator for option)
48 // Set by: Nothing. This is currently only set after initialization in LLDB.
49 ////////////////////////////////////////////////////////////////////////////////
51 // Default value: {} (No enum associated with this option)
53 // - `EnumArg`: Sets the argument type and assigns it a enum holding the valid
54 // values. The enum needs to be a variable in the including code.
55 // Marks the option as required (see option_has_arg).
56 // Example: def foo : Option<"foo", "f">,
57 // EnumArg<"SortOrder",
58 // "OptionEnumValues(g_sort_option_enumeration)">;
59 ////////////////////////////////////////////////////////////////////////////////
60 // Field: completion_type
61 // Default value: CommandCompletions::eNoCompletion (no tab completion)
63 // - `Completion`: Gives the option a single completion kind.
64 // Example: def foo : Option<"foo", "f">,
65 // Completion<"DiskFile">;
66 // Sets the completion to eDiskFileCompletion
68 // - `Completions`: Sets a given kinds of completions.
69 // Example: def foo : Option<"foo", "f">,
70 // Completions<["DiskFile", "DiskDirectory"]>;
71 // Sets the completion to
72 // `eDiskFileCompletion | eDiskDirectoryCompletion`.
73 ////////////////////////////////////////////////////////////////////////////////
74 // Field: argument_type
75 // Default value: eArgTypeNone
77 // - `OptionalArg`: Sets the argument type and marks it as optional.
78 // Example: def foo : Option<"foo", "f">, OptionalArg<"Pid">;
79 // Sets the argument type to eArgTypePid and marks option as
80 // optional (see option_has_arg).
81 // - `Arg`: Sets the argument type and marks it as required.
82 // Example: def foo : Option<"foo", "f">, Arg<"Pid">;
83 // Sets the argument type to eArgTypePid and marks option as
84 // required (see option_has_arg).
85 // - `EnumArg`: Sets the argument type and assigns it a enum holding the valid
86 // values. The enum needs to be a variable in the including code.
87 // Marks the option as required (see option_has_arg).
88 // Example: def foo : Option<"foo", "f">,
89 // EnumArg<"SortOrder",
90 // "OptionEnumValues(g_sort_option_enumeration)">;
91 ////////////////////////////////////////////////////////////////////////////////
95 // - `Desc`: Sets the description for the given option.
96 // Example: def foo : Option<"foo", "f">, Desc<"does nothing.">;
97 // Sets the description to "does nothing.".
99 // Base class for all options.
100 class Option<string fullname, string shortname> {
101 string FullName = fullname;
102 string ShortName = shortname;
103 // The full associated command/subcommand such as "settings set".
107 // Moves the option into a list of option groups.
108 class Groups<list<int> groups> {
109 list<int> Groups = groups;
112 // Moves the option in all option groups in a range.
113 // Start and end values are inclusive.
114 class GroupRange<int start, int end> {
115 int GroupStart = start;
118 // Moves the option in a single option group.
119 class Group<int group> {
120 int GroupStart = group;
121 int GroupEnd = group;
124 // Sets the description for the option that should be
125 // displayed to the user.
126 class Desc<string description> {
127 string Description = description;
130 // Marks the option as required when calling the
131 // associated command.
136 // Gives the option an optional argument.
137 class OptionalArg<string type> {
138 string ArgType = type;
142 // Gives the option an required argument.
143 class Arg<string type> {
144 string ArgType = type;
147 // Gives the option an required argument.
148 class EnumArg<string type, string enum> {
149 string ArgType = type;
150 string ArgEnum = enum;
153 // Sets the available completions for the given option.
154 class Completions<list<string> completions> {
155 list<string> Completions = completions;
157 // Sets a single completion for the given option.
158 class Completion<string completion> {
159 list<string> Completions = [completion];