consolefx - ConsoleFx.CmdLine.Parser 2.0.0-build.423

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.

The ConsoleFx.CmdLine.Parser package provides a sophisticated command-line arguments parser.

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

Copy to clipboard

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

Copy to clipboard

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

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

nuget ConsoleFx.CmdLine.Parser  ~> 2.0.0-build.423
Copy to clipboard

> choco install ConsoleFx.CmdLine.Parser --version 2.0.0-build.423 --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.CmdLine.Parser" -RequiredVersion "2.0.0-build.423" -Repository "consolefx" -AllowPreRelease
Copy to clipboard

Browse the sources in this package using Visual Studio or WinDbg by configuring the following legacy symbol server URL: https://www.myget.org/F/consolefx/symbols/


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.423)
  • .NETStandard 2.0: 2.0.0.0

                        
Assembly Assembly hash Match
/lib/netstandard2.0/consolefx.cmdline.parser.dll 0c649b248906404cb0ce7bb5a7f34c43FFFFFFFF

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

0 total downloads
0 downloads for version 2.0.0-build.423
Download (39.21 KB)
Download legacy symbols (59.62 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.0-build.423 39.21 KB Sat, 21 May 2022 15:07:50 GMT 0
2.0.0-build.422 39.21 KB Wed, 18 May 2022 20:55:21 GMT 0
2.0.0-build.421 39.21 KB Wed, 18 May 2022 20:45:11 GMT 0
2.0.0-build.420 65.05 KB Thu, 14 Oct 2021 16:07:37 GMT 0
2.0.0-build.419 65.05 KB Wed, 06 Oct 2021 19:56:03 GMT 0
2.0.0-build.418 64.94 KB Wed, 06 Oct 2021 15:40:29 GMT 0
2.0.0-build.417 64.93 KB Tue, 05 Oct 2021 22:37:37 GMT 0
2.0.0-build.416 64.92 KB Tue, 05 Oct 2021 14:10:24 GMT 0
2.0.0-build.415 64.91 KB Tue, 05 Oct 2021 13:55:59 GMT 0
2.0.0-build.413 64.88 KB Wed, 29 Sep 2021 19:59:46 GMT 0
2.0.0-build.411 64.88 KB Wed, 29 Sep 2021 19:46:17 GMT 0
2.0.0-build.410 63.97 KB Wed, 29 Sep 2021 13:24:18 GMT 0
2.0.0-build.409 63.95 KB Thu, 23 Sep 2021 08:34:21 GMT 0
2.0.0-build.408 63.96 KB Wed, 22 Sep 2021 21:28:59 GMT 0
2.0.0-build.407 63.9 KB Wed, 22 Sep 2021 16:11:17 GMT 0
2.0.0-build.406 63.98 KB Wed, 22 Sep 2021 15:31:32 GMT 0
2.0.0-build.405 63.79 KB Sat, 18 Sep 2021 10:40:59 GMT 0
2.0.0-build.403 63.78 KB Sat, 18 Sep 2021 10:34:54 GMT 0
2.0.0-build.401 49.24 KB Tue, 14 Sep 2021 23:16:55 GMT 0
2.0.0-build.399 49.22 KB Fri, 03 Sep 2021 23:18:57 GMT 0
2.0.0-build.267 49.22 KB Thu, 19 Nov 2020 09:02:05 GMT 0