You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **Improved:** Updated to final version `2.0.0` of `System.CommandLine`.
- **Improved:** Remove `SourceRevisionId` (commit id) from `AssemblyInformationalVersion` (`<InformationalVersion>`)
so that displayed app version and result of `--version` command is clean and concise.
For example display `MyApp v2.0.0` instead of `MyApp v2.0.0+b0f34d51fccc69fd334253924abd8d6853fad7aa`.
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,9 +124,9 @@ if (result.ParseResult.Errors.Count > 0)
124
124
}
125
125
```
126
126
#### Summary
127
-
- Mark the class with `[CliCommand]` attribute to make it a CLI command (see [CliCommandAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliCommandAttribute.htm) docs for more info).
128
-
- Mark a property with `[CliOption]` attribute to make it a CLI option (see [CliOptionAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliOptionAttribute.htm) docs for more info).
129
-
- Mark a property with `[CliArgument]` attribute to make it a CLI argument (see [CliArgumentAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliArgumentAttribute.htm) docs for more info).
127
+
- Mark the class with `[CliCommand]` attribute to make it a CLI command (see [CliCommandAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliCommandAttribute.html) docs for more info).
128
+
- Mark a property with `[CliOption]` attribute to make it a CLI option (see [CliOptionAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliOptionAttribute.html) docs for more info).
129
+
- Mark a property with `[CliArgument]` attribute to make it a CLI argument (see [CliArgumentAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliArgumentAttribute.html) docs for more info).
130
130
- Add a method with name `Run` or `RunAsync` to make it the handler for the CLI command. The method can have one of the following signatures:
131
131
132
132
-
@@ -167,7 +167,7 @@ if (result.ParseResult.Errors.Count > 0)
167
167
If no handler method is provided, then by default it will show help for the command.
168
168
This can be also controlled manually by `ShowHelp()` method of `CliContext`.
169
169
Other methods `IsEmptyCommand()`, `IsEmpty()`, `ShowValues()` and `ShowHierarchy()` are also useful.
170
-
- Call `Cli.Run<>` or`Cli.RunAsync<>` method with your classname to run your CLI app (see [Cli](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_Cli.htm) docsformore info).
170
+
- Call `Cli.Run<>` or`Cli.RunAsync<>` method with your classname to run your CLI app (see [Cli](https://dotmake.build/command-line/api/DotMake.CommandLine.Cli.html) docsformore info).
171
171
- For best practice, create a subfolder named `Commands` in your project and put your command classes there
172
172
so that they are easy to locate and maintain in the future.
173
173
@@ -192,9 +192,9 @@ And that's it! You now have a fully working command-line app.
192
192
#### Summary
193
193
- Pass a delegate (a parenthesized lambda expression or a method reference) which has parameters that represent your options and arguments, to `Cli.Run`.
194
194
- A parameter is by default considered as a CLI option but you can;
195
-
- Mark a parameter with `[CliArgument]` attribute to make it a CLI argument and specify settings (see [CliArgumentAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliArgumentAttribute.htm) docs for more info).
196
-
- Mark a parameter with `[CliOption]` attribute to specify CLI option settings (see [CliOptionAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliOptionAttribute.htm) docs for more info).
197
-
- Mark the delegate itself with `[CliCommand]` attribute to specify CLI command settings (see [CliCommandAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliCommandAttribute.htm) docs for more info).
195
+
- Mark a parameter with `[CliArgument]` attribute to make it a CLI argument and specify settings (see [CliArgumentAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliArgumentAttribute.html) docs for more info).
196
+
- Mark a parameter with `[CliOption]` attribute to specify CLI option settings (see [CliOptionAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliOptionAttribute.html) docs for more info).
197
+
- Mark the delegate itself with `[CliCommand]` attribute to specify CLI command settings (see [CliCommandAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliCommandAttribute.html) docs for more info).
198
198
- Note that for being able to mark a parameter with an attribute in an anonymous lambda function,
199
199
if your target framework is below net6.0, you also need `<LangVersion>10.0</LangVersion>` tag (minimum) in your .csproj file.
200
200
- Set a default value for a parameter if you want it to be optional (not required to be specified on the command-line).
@@ -889,7 +889,7 @@ public class My2CliCommand : IOptionsGroup1
889
889
```
890
890
891
891
---
892
-
The properties for `[CliCommand]` attribute (see [CliCommandAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliCommandAttribute.htm) docs for more info):
892
+
The properties for `[CliCommand]` attribute (see [CliCommandAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliCommandAttribute.html) docs for more info):
893
893
- Name
894
894
- Description
895
895
- Hidden
@@ -944,7 +944,7 @@ Only the last option can specify an argument.
944
944
Note that if you have an explicit option named "-abc" then it will win over bundled options.
945
945
946
946
---
947
-
The properties for `[CliOption]` attribute (see [CliOptionAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliOptionAttribute.htm) docs for more info):
947
+
The properties for `[CliOption]` attribute (see [CliOptionAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliOptionAttribute.html) docs for more info):
948
948
- Name
949
949
- Description
950
950
- Hidden
@@ -1003,7 +1003,7 @@ Quiet
1003
1003
```
1004
1004
1005
1005
---
1006
-
The properties for `[CliArgument]` attribute (see [CliArgumentAttribute](https://dotmake.build/command-line/api/html/T_DotMake_CommandLine_CliArgumentAttribute.htm) docs for more info):
1006
+
The properties for `[CliArgument]` attribute (see [CliArgumentAttribute](https://dotmake.build/command-line/api/DotMake.CommandLine.CliArgumentAttribute.html) docs for more info):
Copy file name to clipboardExpand all lines: src/TestApp/GeneratedFiles/net472/DotMake.CommandLine.SourceGeneration/DotMake.CommandLine.SourceGeneration.CliIncrementalGenerator/(ModuleInitializerAttribute).g.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
// <auto-generated />
2
-
// Generated by DotMake.CommandLine.SourceGeneration v2.8.2.0
Copy file name to clipboardExpand all lines: src/TestApp/GeneratedFiles/net472/DotMake.CommandLine.SourceGeneration/DotMake.CommandLine.SourceGeneration.CliIncrementalGenerator/(RequiredMemberAttribute).g.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
// <auto-generated />
2
-
// Generated by DotMake.CommandLine.SourceGeneration v2.8.2.0
Copy file name to clipboardExpand all lines: src/TestApp/GeneratedFiles/net472/DotMake.CommandLine.SourceGeneration/DotMake.CommandLine.SourceGeneration.CliIncrementalGenerator/ArgumentConverterCliCommandBuilder-3j0trcm.g.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
// <auto-generated />
2
-
// Generated by DotMake.CommandLine.SourceGeneration v2.8.2.0
0 commit comments