consolefx - ConsoleFx 2.0.0-build.401

ConsoleFx is a suite of .NET libraries for building command-line (CLI) applications, including support for a sophisticated command line argument parser, interactive prompts, ASCII art, console capture and extensions to the Console class.

PM> Install-Package ConsoleFx -Version 2.0.0-build.401 -Source https://www.myget.org/F/consolefx/api/v3/index.json

Copy to clipboard

> nuget.exe install ConsoleFx -Version 2.0.0-build.401 -Source https://www.myget.org/F/consolefx/api/v3/index.json

Copy to clipboard

> dotnet add package ConsoleFx --version 2.0.0-build.401 --source https://www.myget.org/F/consolefx/api/v3/index.json

Copy to clipboard
<PackageReference Include="ConsoleFx" Version="2.0.0-build.401" />
Copy to clipboard
source https://www.myget.org/F/consolefx/api/v3/index.json

nuget ConsoleFx  ~> 2.0.0-build.401
Copy to clipboard

> choco install ConsoleFx --version 2.0.0-build.401 --source https://www.myget.org/F/consolefx/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "consolefx" -SourceLocation "https://www.myget.org/F/consolefx/api/v2"
Install-Module -Name "ConsoleFx" -RequiredVersion "2.0.0-build.401" -Repository "consolefx" -AllowPreRelease
Copy to clipboard

ConsoleFx

ConsoleFx

Build status Test status codecov

ConsoleFx is a suite of .NET libraries for building command-line (CLI) applications.

Build console apps with command line arguments

The following code simulates the following made-up console app:

COPY <source file> [<destination dir>] [--overwrite] [--create-dir]

public class Program : ConsoleProgram
{
    // Declare one property per argument and option.
    
    public string SourceFile { get; set; }
    
    public string DestinationDir { get; set; }
    
    [Option("overwrite")]
    public bool OverwriteExistingFile { get; set; }
    
    [Option("create-dir")]
    public bool CreateDirIfMissing { get; set; }
    
    // Code to execute the console program if all command line args are verified.
    protected int HandleCommand()
    {
        Console.WriteLine($"You want to copy {SourceFile} to {DestinationDir}");
        Console.WriteLine($"Overwrite file if it exists: {OverwriteExistingFile}");
        Console.WriteLine($"Create destination directory if it does not exist: {CreateDirIfMissing}");
        return 0;
    }
    
    // Specify the options and arguments that are accepted by the console app
    protected override IEnumerable<Arg> GetArgs()
    {
        yield return new Argument(nameof(SourceFile))
            .ValidateAsFile(shouldExist: true);
        yield return new Argument(nameof(DestinationDir), optional: true)
            .ValidateAsDirectory();
        yield return new Option("overwrite", "o")
            .UsedAsFlag();
        yield return new Option("create-dir", "c")
            .UsedAsFlag();
    }
    
    public static int Main()
    {
        var program = new Program();
        return program.Run();
    }
}

Packages

ConsoleFx consists of the following NuGet packages. Development packages from continuous integration builds are available on MyGet.

Package Description Dev Build
ConsoleFx.CmdLine.Program Write command line programs with sophisticated argument parsing, including error handling, automatic help generation and rich validation support. Supports both Unix and Windows-style arguments. ConsoleFx.CmdLine.Program
ConsoleFx.CmdLine.Parser Standalone argument parser that is used by ConsoleFx.CmdLine.Program. Can be used in non-console program such as Windows Forms, WPF, REPL, etc. to parse command line arguments in a similar fashion. ConsoleFx.CmdLine.Parser
ConsoleFx.ConsoleExtensions Extended console capabilities like color output, prompts, inputting secrets, outputting indented text, progress bars, etc. ConsoleFx.ConsoleExtensions
ConsoleFx.Prompter Rich interactive framework from getting inputs from users. Inspired by the Inquirer.js framework for JavaScript. ConsoleFx.Prompter

Metapackage

ConsoleFx includes a metapackage that contains all the major packages that would typically needed to build a complex console application.

NuGet Version NuGet Downloads ConsoleFx

Under development

The following packages are under development and expected in a future release.

Package Description Expected Version
ConsoleFx.Art Output ASCII art in different styles. 2.1
ConsoleFx.UI Dynamic creation of Windows Forms and WPF UI to visually input command-line arguments. TBD
  • .NETStandard 2.0
    • ConsoleFx.CmdLine.Abstractions (>= 2.0.0-build.401)
    • ConsoleFx.CmdLine.Parser (>= 2.0.0-build.401)
    • ConsoleFx.CmdLine.Program (>= 2.0.0-build.401)
    • ConsoleFx.ConsoleExtensions (>= 2.0.0-build.401)
    • ConsoleFx.Prompter (>= 2.0.0-build.401)

Owners

Jeevan James

Authors

Jeevan James

Project URL

https://github.com/JeevanJames/ConsoleFx/

License

Unknown

Tags

ConsoleFx Console Command Commandline Command-line Cmdline Parser CMD CLI

Info

2 total downloads
2 downloads for version 2.0.0-build.401
Download (2.27 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.0-build.401 2.27 KB Tue, 14 Sep 2021 23:16:32 GMT 2
2.0.0-build.399 2.27 KB Fri, 03 Sep 2021 23:18:34 GMT 0
2.0.0-build.397 2.27 KB Wed, 25 Aug 2021 08:12:40 GMT 0
2.0.0-build.394 2.27 KB Wed, 25 Aug 2021 08:03:54 GMT 0
2.0.0-build.393 2.27 KB Wed, 25 Aug 2021 08:00:01 GMT 0
2.0.0-build.391 2.27 KB Wed, 25 Aug 2021 07:53:32 GMT 0
2.0.0-build.390 2.27 KB Wed, 25 Aug 2021 07:50:05 GMT 0
2.0.0-build.388 2.27 KB Wed, 25 Aug 2021 07:43:59 GMT 0
2.0.0-build.386 2.27 KB Wed, 25 Aug 2021 07:37:45 GMT 0
2.0.0-build.384 2.27 KB Wed, 25 Aug 2021 07:33:08 GMT 0
2.0.0-build.382 2.27 KB Wed, 25 Aug 2021 07:28:00 GMT 0
2.0.0-build.381 2.27 KB Wed, 25 Aug 2021 07:24:14 GMT 0
2.0.0-build.376 10.64 KB Mon, 23 Aug 2021 13:40:52 GMT 0
2.0.0-build.375 10.64 KB Mon, 23 Aug 2021 10:20:57 GMT 0
2.0.0-build.374 10.64 KB Mon, 23 Aug 2021 10:14:40 GMT 0
2.0.0-build.373 10.64 KB Mon, 23 Aug 2021 10:11:17 GMT 0
2.0.0-build.372 10.64 KB Mon, 23 Aug 2021 10:02:19 GMT 0
2.0.0-build.371 10.64 KB Mon, 23 Aug 2021 09:27:27 GMT 0
2.0.0-build.370 10.64 KB Mon, 23 Aug 2021 09:09:03 GMT 0
2.0.0-build.368 2.27 KB Sun, 22 Aug 2021 23:46:44 GMT 0