Commandr_JonekCode 0.0.1

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

Install-Package Commandr_JonekCode -Version 0.0.1
dotnet add package Commandr_JonekCode --version 0.0.1
paket add Commandr_JonekCode --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Commandr

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

Nuget Link

https://www.nuget.org/packages/Commandr_JonekCode/

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 :)

Commandr

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

Nuget Link

https://www.nuget.org/packages/Commandr_JonekCode/

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 :)

Release Notes

Initial release.

  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
0.0.1 84 9/19/2018