© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
24 replies
Thinker

❔ Default command in System.CommandLine

I'm using System.CommandLine for a little CLI, and I want two commands:
compile
compile
and
run
run
. What I want is for the user to be able to just do
myapp path/to/some.file
myapp path/to/some.file
which would invoke
compile
compile
by default, but also be able to do
myapp run path/to/some.file
myapp run path/to/some.file
, in a similar vein to how
dotnet path/to/some.file
dotnet path/to/some.file
is just
dotnet exec path/to/some.file
dotnet exec path/to/some.file
. How do you do this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

[System.Commandline] how to exit on --help
C#CC# / help
3y ago
System.CommandLine and injection of IOptions (not Option!) type
C#CC# / help
4y ago
✅ System.CommandLine -> How to create a option without a parameter?
C#CC# / help
3y ago
❔ Compiling XAML + CSharp from commandline
C#CC# / help
4y ago