Skip to content

Lperlind/SimpleCSConsole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

SimpleCSConsole

A simple to use console for c#

Usage

Adding a Command

Just add the attribute [Command("")] on any method that takes an array of strings as an argument. The method must be marked as static

using SimpleCSConsole;

[Command("foo")]
private static void Bar(string[] args)
{
  //execute your code
}

The above example can be executed typing in "/foo".

Executing a Command

Will try and execute a command

using SimpleCSConsole;

//explicitly try and run the command
void Explicit()
{
  ConsoleCommands.TryCommand("/foo");
}

//run a command based on user input, will ignore bad commands
void ThroughConsole()
{
  ConsoleCommands.TryCommand(Console.NextLine());
}

Notes

  • You cannot have duplicate command names
  • The command /help will print all loaded commands to the console

About

Simple to use console for c#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages