https://github.com/sh1kxrv/awwarecmds
.NET Framework library
https://github.com/sh1kxrv/awwarecmds
arguments command-line commands cshrap library netframework
Last synced: 3 months ago
JSON representation
.NET Framework library
- Host: GitHub
- URL: https://github.com/sh1kxrv/awwarecmds
- Owner: sh1kxrv
- License: gpl-3.0
- Created: 2019-12-30T07:45:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-22T07:02:29.000Z (over 4 years ago)
- Last Synced: 2025-02-07T05:31:23.550Z (4 months ago)
- Topics: arguments, command-line, commands, cshrap, library, netframework
- Language: C#
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AwwareCmds
.NET Framework library to help implement command line with your commands
# Mini-Manual
With modules
```cs
var executer = new CommandService()
executer.AttachModulesFromFolder("UR FOLDER");
```
If your commands are in this assembly
```cs
var executer = new CommandService()
executer.AttachModule(Assembly.GetExecutingAssembly());
```For more - see CmdTest and TestModule
How to add command?
```cs
public class TestCommand : AbstractCommand
{
public override string Name => "Test Command";public override string InputCommand => "test";
public override string InputCommandAbbr => "t";
public override Task CommandExecute(object[] attributes, string[] subcmds)
{
TaskCompletionSource res = new TaskCompletionSource();
res.SetResult(CommandResult.Default);
return res.Task;
}public override void CommandInitialization()
{}
}
```How to use subcommands?
```cs
public override Task CommandExecute(object[] attributes, string[] subcmds)
{
TaskCompletionSource res = new TaskCompletionSource();
res.SetResult(CommandResult.Default);
//Instead 'args.SubCmds[0]' you can use args.IsSubcmd(INDEX, "SUBCMD");
if(subcmds[0] == "test") // -> /CMD test
{
CommandService.Interactor.Info("It's 'test' subcommand");
if(subcmds[1] == "test2") // -> /CMD test test2
{
CommandService.Interactor.Info("It's 'test2' subcommand");
//etc.
}
}
else if(subcmds[1] == "test3") // -> /CMD test3
{
//Code
}
return res.Task;
}
```
How to use String arguments?
```cs
public override Task CommandExecute(object[] attributes, string[] subcmds)
{
TaskCompletionSource res = new TaskCompletionSource();
res.SetResult(CommandResult.Default);
if(subcmds[0] == "str") // -> /CMD str "My string"
{
CommandService.Interactor.Info($"Your string is '{attributes[0]}'");
}
return res.Task;
}
```How to use NumberArguments?
```cs
public override Task CommandExecute(object[] attributes, string[] subcmds)
{
TaskCompletionSource res = new TaskCompletionSource();
res.SetResult(CommandResult.Default);
if(subcmds[0] == "numb") // -> /CMD numb 0.25 25
{
CommandService.Interactor.Info($"Your first number is '{(double)attributes[0]}', your second numb is '{(int)attributes[1]}'");
}
return res.Task;
}
```