Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

JTinkers/Commandr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commandr

Simple package that allows you to bind startup parameters directly to methods.

Nuget Link

Click!

Table of Contents

Installation

  • run Install-Package Commandr_JonekCode via Package Manager.

All functionality is now accessible via 'Commandr' namespace.

Usage

  • Create a class that'll be your Command Controller, then add [CmdController] on top of its' declaration as seen here:
[CmdController]
class StartupManager
{

}
  • Add a method to your class for each parameter you want your controller to process:

Make sure your methods are static and your arguments start with - or --.

[CmdHook("-one")]
public static void PrintOne(string a, string b)
{
    Console.WriteLine($"{a} - {b}");
}

[CmdHook("-two")]
public static void PrintTwo()
{
    Console.WriteLine("No argument there :)");
}
  • Add this line anywhere in your Main() to let the controller know when to process the arguments:
CmdController.Process(args);
  • The result of running this example app with -one "yes" "no" -two as the startup params is:
yes - no
No argument there :)

About

Simple package that allows you to bind startup parameters directly to methods.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages