Last active
April 26, 2024 20:32
-
-
Save fkromer/91b774e01270e675ba1a921703eea378 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| framework | cocona | commanddotnet | commandline | command-line-api | CommandLineUtils | CliFx | ||
|---|---|---|---|---|---|---|---|---|
| maintenance | github contributors | 4 | 4 | 78 | 75 | 92 | 14 | |
| releases | 12 | ? | 17 | 3 | 45 | 17 | ||
| .NET foundation project | no | no | no | yes | no | no | ||
| user acceptance | github stars | 366 | 223 | 2500 | 1800 | 1500 | 875 | |
| github used by | 22 | 88 | 11900 | ? | 1900 | 51 | ||
| .NET compatibility | .NET Standard 2.0+ | .NET Standard 2.0+ | .NET Framework 4.0+/.NET Standard | .NET Standard 2.0+ | .NET Framework 4.5.1/.NET Standard 1.3 | .NET Standard 2.0+/.NET Core 2.0+/.NET Framework 4.6.1+ | ||
| F# support | ? | ? | yes | yes | ? | ? | ||
| multi-level command hierarchies | yes | |||||||
| UNIX CLI style support | yes | yes | yes | |||||
| Configuration | yes | |||||||
| Console Lifetime | yes | |||||||
| Interrupt handling | yes | yes | ||||||
| Logging | yes | |||||||
| Debugging utilities | yes | yes | ||||||
| Dependency Injection | yes | yes | yes | |||||
| Shell-completion | yes | yes | ||||||
| Extension API | yes | ? | ||||||
| testing utilities | yes (extensive features) | yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
System.CommandLine is a very good parser but you need a lot of boilerplate code to get going and the API is hard to discover. This becomes complicated to newcomers and also you would have a lot of ugly code in your Program.cs to maintain. What if you had an easy class-based layer combined with a good parser?
DotMake Command-Line comes to the rescue!
DotMake.CommandLine is a library which provides declarative syntax for System.CommandLine via attributes for easy, fast, strongly-typed (no reflection) usage. The library includes a source generator which automagically converts your classes to CLI commands and properties to CLI options or CLI arguments.
Usage
Create a simple class like this:
In Program.cs, add this single line:
And that's it! You now have a fully working command-line app. You just specify the name of your class which represents your root command to
Cli.Run<>method and everything is wired.If you want to go async, just use this:
You get this result:
Easy!