Rumrunner0.Commander 0.1.1

Prefix Reserved
dotnet add package Rumrunner0.Commander --version 0.1.1
                    
NuGet\Install-Package Rumrunner0.Commander -Version 0.1.1
                    
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="Rumrunner0.Commander" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rumrunner0.Commander" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Rumrunner0.Commander" />
                    
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 Rumrunner0.Commander --version 0.1.1
                    
#r "nuget: Rumrunner0.Commander, 0.1.1"
                    
#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 Rumrunner0.Commander@0.1.1
                    
#: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=Rumrunner0.Commander&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Rumrunner0.Commander&version=0.1.1
                    
Install as a Cake Tool

commander

A simple and intuitive console library to control console applications via commander objects like CommonCommander and ObjectCommander.

This repository contains the Rumrunner0.Commander class library and Rumrunner0.Commander.Demo demo project. All the content in the repository is an original work created to simplify the control of console applications in the .NET ecosystem.

License Nuget

Description

The Rumrunner0.Commander is incredibly simple but highly configurable console command control program. Designed as a command-based utility to provide an intuitive interface to control console applications, Rumrunner0.Commander allows developers to define specific actions, aliases, confirmation prompts, and more. The library is quite simple so it can be improved in many ways.

The Rumrunner0.Commander.Demo.Runnable is a console application demonstrating the usage of the Rumrunner0.Commander library.

Usage

Rumrunner0.Commander Library

using Rumrunner0.Commander.Commanders;
using Rumrunner0.Commander.Commands;
using Rumrunner0.Commander.Demo.Runnable;

// There are 2 different commanders for now: CommonCommander and ObjectCommander.
// Here is usage example of one of the commanders – ObjectCommander.
using var commander = new ObjectCommander<DummyServer>(new DummyServer())
{
    Settings = new ()
    {
        // Default values can be overridden...
        InputPrompt = "Please, enter the command",

        // ...or left as they are (can be omitted).
        ConfirmationPrompt = default!,
        UnknownInputHint = default!,

        // Extra tweaks also have default values
        // but available for override even for specific command.
        UseAliases = true,
        MatchCase = true,
        AskForConfirmation = false
    },
    CustomCommands =
    [
        new ()
        {
            Action = commandable => commandable.Initialize(),
            Settings = new ()
            {
                Name = "initialize",
                Aliases = [ "init" ],

                // Commander will NOT use the aliases of this specific command.
                UseAliases = false
            }
        },
        new ()
        {
            Action = commandable => commandable.Start(),
            Settings = new ()
            {
                Name = "start",
                Aliases = [ "begin", "run" ],

                // Commander WILL treat "Start", "rUn" etc. as valid command names.
                MatchCase = false
            }
        },
        new ()
        {
            Action = commandable => commandable.Stop(),
            Settings = new ()
            {
                Name = "stop",
                Aliases = [ "terminate" ],

                // Commander WILL ask for confirmation.
                // This overrides behaviour specified on Commander level.
                AskForConfirmation = true,
                ConfirmationPrompt = "This command will STOP the server. Are you sure?"
            }
        }
    ],

    // System commands such as "help" or "quit" can be overridden.
    // All parameters are available for override EXCEPT Action and Name.
    SystemCommandsOverrides = new ()
    {
        [Command.System.Name.Quit] = new ()
        {
            Aliases = [ "release", "exit", "qq" ],
            ConfirmationPrompt = "You are about to QUIT the commander. Are you sure?"
        }
    }

// Commander has to be run after the configuration.
}.Run();

Rumrunner0.Commander.Demo.Runnable Console Application

To understand how to utilize the Rumrunner0.Commander library, theRumrunner0.Commander.Demo demo project provides comprehensive examples for various use cases. Simply browse the demo project to get started.

History

The Commander project is developed with an emphasis on flexibility and robustness, aiming to provide developers with fine-grained control over console applications in a .NET environment.

Contributing

If you have any suggestions, ideas, or feedback to enhance the project, please feel free to create an issue. Your collaboration is welcomed to make this project more powerful and efficient.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • 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.1.1 253 1/3/2024