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// See argument_type field for more info. 45//////////////////////////////////////////////////////////////////////////////// 46// Field: validator 47// Default value: 0 (No validator for option) 48// Set by: Nothing. This is currently only set after initialization in LLDB. 49//////////////////////////////////////////////////////////////////////////////// 50// Field: enum_values 51// Default value: {} (No enum associated with this option) 52// Set by: 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) 62// Set by: 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 67// 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 76// Set by: 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//////////////////////////////////////////////////////////////////////////////// 92// Field: usage_text 93// Default value: "" 94// Set by: 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.". 98 99// Base class for all options. 100class Option<string fullname, string shortname> { 101 string FullName = fullname; 102 string ShortName = shortname; 103 // The full associated command/subcommand such as "settings set". 104 string Command; 105} 106 107// Moves the option into a list of option groups. 108class Groups<list<int> groups> { 109 list<int> Groups = groups; 110} 111 112// Moves the option in all option groups in a range. 113// Start and end values are inclusive. 114class GroupRange<int start, int end> { 115 int GroupStart = start; 116 int GroupEnd = end; 117} 118// Moves the option in a single option group. 119class Group<int group> { 120 int GroupStart = group; 121 int GroupEnd = group; 122} 123 124// Sets the description for the option that should be 125// displayed to the user. 126class Desc<string description> { 127 string Description = description; 128} 129 130// Marks the option as required when calling the 131// associated command. 132class Required { 133 bit Required = 1; 134} 135 136// Gives the option an optional argument. 137class OptionalArg<string type> { 138 string ArgType = type; 139 bit OptionalArg = 1; 140} 141 142// Gives the option an required argument. 143class Arg<string type> { 144 string ArgType = type; 145} 146 147// Gives the option an required argument. 148class EnumArg<string type, string enum> { 149 string ArgType = type; 150 string ArgEnum = enum; 151} 152 153// Sets the available completions for the given option. 154class Completions<list<string> completions> { 155 list<string> Completions = completions; 156} 157// Sets a single completion for the given option. 158class Completion<string completion> { 159 list<string> Completions = [completion]; 160} 161