consolefx - ConsoleFx.CmdLine.Program 2.0.0-build.411

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.Program package provides support for creating console applications.

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

Copy to clipboard

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

Copy to clipboard

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

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

nuget ConsoleFx.CmdLine.Program  ~> 2.0.0-build.411
Copy to clipboard

> choco install ConsoleFx.CmdLine.Program --version 2.0.0-build.411 --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.Program" -RequiredVersion "2.0.0-build.411" -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
  • .NETFramework 4.6.1
    • ConsoleFx.CmdLine.Abstractions (>= 2.0.0-build.411)
    • ConsoleFx.CmdLine.Parser (>= 2.0.0-build.411)
  • .NETStandard 2.0
    • ConsoleFx.CmdLine.Abstractions (>= 2.0.0-build.411)
    • ConsoleFx.CmdLine.Parser (>= 2.0.0-build.411)
  • .NETFramework 4.6.1: 4.6.1.0
  • .NETStandard 2.0: 2.0.0.0

                        
Assembly Assembly hash Match
/lib/net461/consolefx.cmdline.program.dll b67e5d78c39241609ec033d9a776eb42FFFFFFFF
/lib/netstandard2.0/consolefx.cmdline.program.dll e3861384d22448cfaaa95c7f5a184699FFFFFFFF

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

149 total downloads
6 downloads for version 2.0.0-build.411
Download (63.93 KB)
Download legacy symbols (81.34 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.0-build.423 35.24 KB Sat, 21 May 2022 15:07:55 GMT 8
2.0.0-build.422 40.04 KB Wed, 18 May 2022 20:55:26 GMT 7
2.0.0-build.421 40.03 KB Wed, 18 May 2022 20:46:02 GMT 7
2.0.0-build.420 66.78 KB Thu, 14 Oct 2021 16:07:45 GMT 7
2.0.0-build.419 66.77 KB Wed, 06 Oct 2021 19:56:11 GMT 7
2.0.0-build.418 66.77 KB Wed, 06 Oct 2021 15:40:37 GMT 5
2.0.0-build.417 66.78 KB Tue, 05 Oct 2021 22:37:44 GMT 8
2.0.0-build.416 66.46 KB Tue, 05 Oct 2021 14:10:33 GMT 6
2.0.0-build.415 66.42 KB Tue, 05 Oct 2021 13:56:07 GMT 8
2.0.0-build.413 63.9 KB Wed, 29 Sep 2021 19:59:54 GMT 8
2.0.0-build.411 63.93 KB Wed, 29 Sep 2021 19:46:25 GMT 6
2.0.0-build.410 63.8 KB Wed, 29 Sep 2021 13:24:26 GMT 8
2.0.0-build.409 62.16 KB Thu, 23 Sep 2021 08:34:29 GMT 6
2.0.0-build.408 62.17 KB Wed, 22 Sep 2021 21:29:07 GMT 6
2.0.0-build.407 61.54 KB Wed, 22 Sep 2021 16:11:27 GMT 8
2.0.0-build.406 61.53 KB Wed, 22 Sep 2021 15:31:40 GMT 7
2.0.0-build.405 59.89 KB Sat, 18 Sep 2021 10:41:06 GMT 8
2.0.0-build.403 59.89 KB Sat, 18 Sep 2021 10:35:01 GMT 7
2.0.0-build.401 38.45 KB Tue, 14 Sep 2021 23:17:05 GMT 7
2.0.0-build.399 38.44 KB Fri, 03 Sep 2021 23:19:07 GMT 8
2.0.0-build.267 38.45 KB Thu, 19 Nov 2020 09:02:05 GMT 7