Giter VIP home page Giter VIP logo

commanddotnet's Introduction

CommandDotNet

Nuget NuGet Pre Release NuGet GitHub Netlify

GitHub last commit Travis (.com) branch

Discord


Documentation

Version 3 (Current): https://commanddotnet.bilal-fazlani.com

Version 2 (Previous): https://v2.commanddotnet.bilal-fazlani.com

Model your command line application interface in a class

The purpose of this framework is to let developers focus on the core logic of command line application by defining commands with methods and arguments with parameters.

Out-of-the-box support for help documentation, subcommmands, dependency injection, validation, piping, prompting, passwords, response files and more.

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

commanddotnet's People

Contributors

bilal-fazlani avatar drewburlingame avatar nicolasdorier avatar taori avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.