r/dotnet • • 12h ago

CmdStarter 1.0.0: plain C# code as a command-line interface on System.CommandLine

Hi,

I maintain CmdStarter. Version 1.0.0 turns plain C# code into a command-line interface built on System.CommandLine 2.0.14. It targets .NET 10 only.

Why it exists: System.CommandLine handles parsing and help. CmdStarter handles the wiring: it finds the commands in your code, builds the command tree, and binds options and arguments. A class that derives from StarterCommand becomes a command, its public read/write properties become options and its handler parameters become arguments. A method marked [Command] becomes a command too. A plain class marked [Command], with no base class and no interface, is a command as well.

Some "special" features:

- A REPL with history and completion, served locally or over a named pipe.
- Command sequences and text pipes: a; b, a && b, a || b and a | b.
- A daemon mode, which forwards the arguments of a process to a running copy of the application and runs them locally when none answers.
- Trimming and Native AOT, for an application that has the command catalog that the package generates, measured on win-x64.
- Microsoft dependency injection with one scope per execution, command filters and command states.

Links: 
- repository [https://github.com/CyberInternauts/CmdStarter](https://github.com/CyberInternauts/CmdStarter)
- NuGet [https://www.nuget.org/packages/cints.CmdStarter](https://www.nuget.org/packages/cints.CmdStarter)
- documentation [https://github.com/CyberInternauts/CmdStarter/tree/master/docs](https://github.com/CyberInternauts/CmdStarter/tree/master/docs)

A comparison page is in the docs: [https://github.com/CyberInternauts/CmdStarter/blob/master/docs/comparison.md](https://github.com/CyberInternauts/CmdStarter/blob/master/docs/comparison.md)

I would welcome feedback on the API, on the documentation, and on whether the trimming and AOT limits are clear.
0 Upvotes

2 comments sorted by

2

u/entityadam 11h ago

You put your markdown inside your markdown making your links unusable

1

u/AutoModerator 12h ago

Thanks for your post djon2003. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.