Skip to content

Starter kit for neatly structured neat .NET Core Console / Command Line Apps

Notifications You must be signed in to change notification settings

iamarcel/dotnet-core-neat-console-starter

Repository files navigation

.NET Core Neat Console Starter

This is a starting point for creating neatly structured .NET Core console apps in C#, using the Microsoft.Extensions.CommandLineUtils package to parse the commands.

I created this working as a student with 4DVision, who create custom software for complex processes of companies and organizations.

Adding a command

GreetCommand is an example of a command, see Commands/GreetCommand.cs.

  1. Create a new class for your command, eg. Commands.ListCommand
  2. Register the command in the RootCommand like this:
app.Command("list", c => ListCommand.Configure(c, options));
  1. Profit!

Adding a global option

IsEnthousiastic is an example of a global option.

  1. Add the property to CommandLineOptions
  2. Add a call to app.Option or app.Argument in CommandLineOptions.Parse and store the result
  3. Store the property in options at the bottom of CommandLineOptions.Parse

Learn more

About

Starter kit for neatly structured neat .NET Core Console / Command Line Apps

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages