An extremly opinionated command line parser.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
res/gfx
samples
src
.editorconfig
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
LICENSE
README.md
appveyor.yml
book.json
build.cake
build.ps1
build.sh
gitversion.yml
global.json

README.md

Spectre.Cli

An extremly opinionated command line parser targeting .NET Standard 2.0.

NuGet Build Status

Usage

Below is a short example of how to configure the command chain. By using some clever generic constraints, the framework guarantees that all settings associated with a command is inherited from the parent commands' settings.

using Spectre.Cli;

public class Program
{
    public static int Main(string[] args)
    {
        var app = new CommandApp();

        app.Configure(config =>
        {
            config.AddBranch<EfSettings>("ef", ef =>
            {
                ef.SetDescription("Fake EF Core .NET Command Line Tools");
                ef.AddBranch<EfDatabaseSettings>("database", database =>
                {
                    database.AddCommand<EfUpdateCommand>("update");
                    database.AddCommand<EfDropCommand>("drop");
                });
            });
        });

        return app.Run(args);
    }
}

You can now execute the drop command like this:

./fakedotnet.exe ef --verbose database --no-color drop --startup-project "./../Foo/Foo.csproj" --dry-run

See the samples directory for more information.