Commit c35aea3
committed
Version 2.6.2
- Changed: Renamed `Cli.GetConfiguration()` to `Cli.GetParser()` and changed return type from `CommandLineConfiguration`
to new class `CliParser`.
This method returns a CLI parser configured for the indicated command and you can call `Parse` or `Run` methods on it.
So you can reuse the same `CliParser` for parsing and running.
```c#
var parser = Cli.GetParser<RootCliCommand>();
var result = parser.Parse(args);
parser.Run(args);
```
Changed return type of `Cli.Parse` methods from `ParseResult` to new class `CliResult` which
describes the results of parsing a command line input based on a specific parser configuration
and provides methods for binding the result to definition classes.
```c#
var result = Cli.Parse<RootCliCommand>(args);
var rootCliCommand = result.Bind<RootCliCommand>();
if (result.ParseResult.Errors.Count > 0)
{
}
```
- Improved: More robust command binding. Introduced `CliBindingContext` for internally encapsulating binders per command build and configuration.
For example, in previous versions, the below code worked incorrectly, i.e. second call to `Cli.Parse` with same definition type,
overwrote the binder so the later `Bind` call did not work correctly.
```c#
var result = Cli.Parse<RootCliCommand>(args);
var result2 = Cli.Parse<RootCliCommand>(args);
var rootCommand = result.Bind<RootCliCommand>();
```1 parent ef6bcba commit c35aea3
File tree
125 files changed
+1839
-1725
lines changed- docs
- src
- DotMake.CommandLine.SourceGeneration/Outputs
- DotMake.CommandLine
- Help
- TestApp
- Commands
- GeneratedFiles
- net472/DotMake.CommandLine.SourceGeneration/DotMake.CommandLine.SourceGeneration.CliIncrementalGenerator
- net8.0/DotMake.CommandLine.SourceGeneration/DotMake.CommandLine.SourceGeneration.CliIncrementalGenerator
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
125 files changed
+1839
-1725
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
| 115 | + | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
| 120 | + | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
Lines changed: 22 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
| 161 | + | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
269 | | - | |
270 | | - | |
| 268 | + | |
271 | 269 | | |
272 | | - | |
| 270 | + | |
273 | 271 | | |
274 | | - | |
| 272 | + | |
275 | 273 | | |
276 | 274 | | |
277 | 275 | | |
| |||
280 | 278 | | |
281 | 279 | | |
282 | 280 | | |
283 | | - | |
| 281 | + | |
284 | 282 | | |
285 | 283 | | |
286 | 284 | | |
| |||
289 | 287 | | |
290 | 288 | | |
291 | 289 | | |
292 | | - | |
| 290 | + | |
293 | 291 | | |
294 | 292 | | |
295 | 293 | | |
| |||
312 | 310 | | |
313 | 311 | | |
314 | 312 | | |
315 | | - | |
| 313 | + | |
316 | 314 | | |
317 | 315 | | |
318 | | - | |
| 316 | + | |
319 | 317 | | |
320 | | - | |
321 | | - | |
| 318 | + | |
| 319 | + | |
322 | 320 | | |
323 | 321 | | |
324 | 322 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
0 commit comments