Skip to content

melanyss/commanddotnet

 
 

Repository files navigation

Nuget NuGet Pre Release NuGet GitHub Netlify

GitHub last commit Travis (.com) branch

Gitter Discord

CommandDotNet

A modern framework for building modern CLI apps

Out of the box support for commands, sub-commands, validations, dependency injection, piping and streaming, enums & custom types, typo suggestions, prompting, passwords, response files and more. See the features page.

Includes test tools used by the framework to test all features of the framework.

Modify and extend the functionality of the framework through configuration and middleware.

Example

public class Calculator
{
    public void Add(int value1, int value2)
    {
        Console.WriteLine($"Answer:  {value1 + value2}");
    }

    public void Subtract(int value1, int value2)
    {
        Console.WriteLine($"Answer:  {value1 - value2}");
    }
}
class Program
{
    static int Main(string[] args)
    {
        return new AppRunner<Calculator>().Run(args);
    }
}

With these two classes, we've defined an Add and Subtract command and help is automatically generated.

~
$ dotnet calc.dll -h
Usage: dotnet calc.dll

Usage: dotnet calc.dll [command]

Commands:

  Add
  Subtract

Use "dotnet calc.dll [command] --help" for more information about a command.

~
$ dotnet calc.dll Add -h
Usage: dotnet calc.dll Add [arguments]

Arguments:

  value1  <NUMBER>

  value2  <NUMBER>

~
$ dotnet calc.dll Add 40 20
Answer: 60

Check out the docs for more examples

Credits 🎉

Special thanks to Drew Burlingame for continuous support and contributions

About

A modern framework for building modern CLI apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.5%
  • Other 0.5%