Skip to content

alexander37137/ConsoleHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConsoleHelper

This is a simple library for handling execution arguments in console applications.

To start using it install package from nuget

Install-Package Console.Helper 

Then define some commands and register them

Command class should implement interface IConsoleCommand and have Command attribute with command key word

    [Command("hello")]
    class HelloCommand : IConsoleCommand
    {
        public void Execute(CommandArgs args)
        {
            Console.WriteLine("Hello World!");
        }
    }

After you register your commands you can ask ConsoleHelper to process input arguments

class Program
    {
        static void Main(string[] args)
        {
            ConsoleHelper.RegisterCommand<HelloCommand>();

            ConsoleHelper.ProcessCommand(args);
        }
    }

Library will find required command and execute it.

C:\ConsoleHelper\TestProject\bin\Debug>TestProject.exe Hello
Hello World!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages