FluentConsoleApplication 0.2.0

dotnet add package FluentConsoleApplication --version 0.2.0
NuGet\Install-Package FluentConsoleApplication -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FluentConsoleApplication" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FluentConsoleApplication --version 0.2.0
#r "nuget: FluentConsoleApplication, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FluentConsoleApplication as a Cake Addin
#addin nuget:?package=FluentConsoleApplication&version=0.2.0

// Install FluentConsoleApplication as a Cake Tool
#tool nuget:?package=FluentConsoleApplication&version=0.2.0

Software Developers often reinvent command-line interfaces for their tools, which is very easy until the application's interface becomes too complex to be modified effectively. This tool is an elegant and quick way to do this and let developers focus of higher tasks.

An application can be used in many ways:

  • Directly from the code, as in the following usage example
  • Called with arguments provided from the console
  • In a Read-Evaluate-Parse Loop (REPL)

Usage example

Defining an application, with all its commands.

var application = FluentConsoleApplication
  .Create("Calculator",  "Application to calculate.")
    .DefineCommand("add", "Add two numbers")
      .WithParameter<int>("X", "First operand")
      .WithParameter<int>("Y", "Second operand")
        .Does(args => Console.WriteLine("Total is " + (args.X + args.Y)))
    .DefineCommand("mult", "Multiply two numbers")
      .WithParameter<double>("X", "First operand")
      .WithParameter<double>("Y", "Second operand")
        .Does(args => Console.WriteLine("Total is " + (args.X * args.Y)));
    .DefineCommand("help")
        .Does(args => Console.WriteLine(args.Application.GetDocumentation()));

Using the application by invoking a command with its required arguments, if any:

application.Run("add 5 2");

Output:

Total is 7

Automatic documentation can also be generated for an Application. This documentation is based on the names, types and descriptions provided when the application was defined.

In this example, the help command generates documentation for the currently running application.

Output:

Calculator: Application to calculate.
 - add [X] [Y] - Add two numbers
 - mult [X] [Y] - Multiply two numbers
 - help
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 1,008 3/11/2018


    - Generate user documentation for the Application
    - Generate user documentation for `DefinedCommand` and `DefinedParameter`
    - Add automatic dynamic field as argument, called `Application`,
      with a pointer to the current Application being run.