|
11 | 11 |
|
12 | 12 | namespace System.CommandLine
|
13 | 13 | {
|
| 14 | + /// <summary> |
| 15 | + /// Represents the configuration used by the <see cref="Parser"/>. |
| 16 | + /// </summary> |
14 | 17 | public class CommandLineConfiguration
|
15 | 18 | {
|
16 | 19 | private readonly IReadOnlyCollection<InvocationMiddleware> _middlewarePipeline;
|
17 | 20 | private readonly Func<BindingContext, IHelpBuilder> _helpBuilderFactory;
|
18 | 21 | private readonly SymbolSet _symbols = new SymbolSet();
|
19 | 22 |
|
| 23 | + /// <summary> |
| 24 | + /// Initializes a new instance of the CommandLineConfiguration class. |
| 25 | + /// </summary> |
| 26 | + /// <param name="symbols">The symbols to parse.</param> |
| 27 | + /// <param name="argumentDelimiters">The characters used to delimit an option from its argument. In addition to |
| 28 | + /// one or more spaces, the default delimiters include <c>:</c> and <c>=</c>.</param> |
| 29 | + /// <param name="enablePosixBundling"><c>true</c> to enable POSIX bundling; otherwise, <c>false</c>.</param> |
| 30 | + /// <param name="enableDirectives"><c>true</c> to enable directive parsing; otherwise, <c>false</c>.</param> |
| 31 | + /// <param name="validationMessages">Provide custom validation messages.</param> |
| 32 | + /// <param name="responseFileHandling">One of the enumeration values that specifies how response files (.rsp) are handled.</param> |
| 33 | + /// <param name="middlewarePipeline">Provide a custom middleware pipeline.</param> |
| 34 | + /// <param name="helpBuilderFactory">Provide a custom help builder.</param> |
| 35 | + /// <exception cref="ArgumentNullException">Thrown when <paramref name="symbols"/> is null.</exception> |
| 36 | + /// <exception cref="ArgumentException">Thrown when <paramref name="symbols"/> does not contain at least one option or command.</exception> |
20 | 37 | public CommandLineConfiguration(
|
21 | 38 | IReadOnlyCollection<Symbol> symbols,
|
22 | 39 | IReadOnlyList<char>? argumentDelimiters = null,
|
@@ -75,7 +92,7 @@ public CommandLineConfiguration(
|
75 | 92 | }
|
76 | 93 | else
|
77 | 94 | {
|
78 |
| - // reuse existing auto-generated root command, if one is present, to prevent repeated mutations |
| 95 | + // Reuse existing auto-generated root command, if one is present, to prevent repeated mutations |
79 | 96 | RootCommand? parentRootCommand =
|
80 | 97 | symbols.SelectMany(s => s.Parents)
|
81 | 98 | .OfType<RootCommand>()
|
@@ -125,22 +142,43 @@ private void AddGlobalOptionsToChildren(Command parentCommand)
|
125 | 142 | }
|
126 | 143 | }
|
127 | 144 |
|
| 145 | + /// <summary> |
| 146 | + /// Represents all of the symbols to parse. |
| 147 | + /// </summary> |
128 | 148 | public ISymbolSet Symbols => _symbols;
|
129 | 149 |
|
| 150 | + /// <summary> |
| 151 | + /// Represents all of the argument delimiters. |
| 152 | + /// </summary> |
130 | 153 | public IReadOnlyList<char> ArgumentDelimiters => ArgumentDelimitersInternal;
|
131 | 154 |
|
132 | 155 | internal IReadOnlyList<char> ArgumentDelimitersInternal { get; }
|
133 | 156 |
|
| 157 | + /// <summary> |
| 158 | + /// Gets whether directives are enabled. |
| 159 | + /// </summary> |
134 | 160 | public bool EnableDirectives { get; }
|
135 | 161 |
|
| 162 | + /// <summary> |
| 163 | + /// Gets whether POSIX bundling is enabled. |
| 164 | + /// </summary> |
| 165 | + /// <remarks> |
| 166 | + /// POSIX recommends that single-character options be allowed to be specified together after a single <c>-</c> prefix. |
| 167 | + /// </remarks> |
136 | 168 | public bool EnablePosixBundling { get; }
|
137 | 169 |
|
| 170 | + /// <summary> |
| 171 | + /// Gets the validation messages. |
| 172 | + /// </summary> |
138 | 173 | public ValidationMessages ValidationMessages { get; }
|
139 | 174 |
|
140 | 175 | internal Func<BindingContext, IHelpBuilder> HelpBuilderFactory => _helpBuilderFactory;
|
141 | 176 |
|
142 | 177 | internal IReadOnlyCollection<InvocationMiddleware> Middleware => _middlewarePipeline;
|
143 | 178 |
|
| 179 | + /// <summary> |
| 180 | + /// Gets the root command. |
| 181 | + /// </summary> |
144 | 182 | public ICommand RootCommand { get; }
|
145 | 183 |
|
146 | 184 | internal ResponseFileHandling ResponseFileHandling { get; }
|
|
0 commit comments