CoreCommandLine 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package CoreCommandLine --version 1.0.3
                    
NuGet\Install-Package CoreCommandLine -Version 1.0.3
                    
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="CoreCommandLine" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreCommandLine" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="CoreCommandLine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoreCommandLine --version 1.0.3
                    
#r "nuget: CoreCommandLine, 1.0.3"
                    
#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.
#:package CoreCommandLine@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CoreCommandLine&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=CoreCommandLine&version=1.0.3
                    
Install as a Cake Tool

Icon

Core Command Line

This is a light-weight dotnet standard 2.1 library, that you can add to your console applications, and create your command line application easily.

How to use

  • Install package from NuGet
  • Create an application by extending the class CommandLineApplication.
  • Add each Command you need, by creating a class which implements ICommand. You can also extend CommandBase instead, so you can make use of some pre implemented and helper methods in it.
  • Introduce each command to your application by using the SubCommand attribute. ex:

  [Subcommands(typeof(FirstCommand),typeof(SecondCommand))]
  public class ExampleApplication:CommandLineApplication{
    ...
  }
  • In your main application entry, instantiate your application and start it.

Please checkout the Example project in repository, for a quick start

Features

  • Simple to use
  • Nested commands (Each command can have its own sub-commands and so on...)
  • Auto generated Help command for each command
  • Can be started as a regular console application OR interactively

Nested Commands

Each command, can have as many sub commands as needed the same way you added your commands to your application class. For a command to have some sub-commands, you would use Subcommands attribute on parent command and introduce it's child commands.

Argument Commands - Context

Arguments would be child commands that their job is to acquire a value from string[] args for it's parent command. the Context object would be the carrie of this data. the argument-command, processes the args[] object, and saves the result in context. and when parent command gets executed, it can check the context object for it's arguments.

Context

  • public void Set<T>(string key, T value)
    • This method will store a value into the context
  • public T Get<T>(string key, T defaultValue)
    • This method would be used to provide previously stored data from the context.
  • ApplicationExit
    • Setting this property inside any command, would cause the chain of commands to be terminated.
  • InteractiveExit
    • Setting this property inside any command, would close the application when is executed interactively.
    • Usually there is no need to set this manually. When you start your application interactively, and exit command is already added to your commands that would set this property when called. So without any extra coding, you can exit the interactive application just by typing exit.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.1.0-pr06 172 11/4/2025
1.1.0-pr05 166 11/3/2025
1.1.0-pr04 85 10/25/2025
1.1.0-pr03 80 10/25/2025
1.1.0-pr02 145 10/21/2025
1.1.0-pr01 139 10/21/2025
1.0.11 210 10/7/2023
1.0.10 153 10/7/2023
1.0.9 141 10/4/2023
1.0.8 288 3/15/2023
1.0.6 388 12/7/2022
1.0.5 426 12/4/2022
1.0.4 398 12/4/2022
1.0.3 413 11/3/2022
1.0.2 440 11/3/2022