Popularity
1.4
Growing
Activity
0.0
Stable
28
2
0

Programming language: C#
License: MIT License
Tags: CLI    
Latest version: v2.2.2.0

JustCli alternatives and similar packages

Based on the "CLI" category.
Alternatively, view JustCli alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of JustCli or a related project?

Add another 'CLI' Package

README

JustCli

That’s just a quick way to create your own command line tool.

The idea is to have one command in one class. A set of attributes helps you to map command line arguments to the command class properties and provide additional information. JustCli scans your project, generates help and allows you to run the commands.

Download

You can install it using NuGet.

Example

Let’s create a “sayhello” command. First of all we need a console application with JustCli entry point.

static int Main(string[] args)
{
    return CommandLineParser.Default.ParseAndExecuteCommand(args);
}

Create SayHelloCommand class and implement command logic.

[Command("sayhello", "Prints a greeting.")]
class SayHelloCommand : ICommand
{
    [CommandArgument("n", "name", Description = "The someone to greet.", DefaultValue = "World")]
    public string Name { get; set; }

    [CommandOutput]
    public IOutput Output { get; set; }

    public int Execute()
    {
        Output.WriteInfo("Hello {0}!", Name);
        return ReturnCode.Success;
    }
}

CommandOutput attribute marks property where the common output is injected. Colored console is used by default.

When run the command line tool we can see command list.

cmd> TestApp.exe
Command list:
sayhello - Prints a greeting.

Also you can get help for a special command.

cmd> TestApp.exe sayhello ? 
sayhello - Prints a greeting.
Options:
  -n  --name  [string]  The someone to greet. [default: World]

That is what JustCli makes for you.

Let's test "sayhello" command.

cmd> TestApp.exe sayhello
Hello World!
cmd> TestApp.exe sayhello -n Bob
Hello Bob!

Now you know how to create command line tool quickly and easily! :)