A simple plugin supported CLI tool.
- .NET 4.8
- Windows 7/10/11
- Some way to clone the repo, e.g.
git
orVisual Studio
.
default repo folder - Usually C:\Users\Username\source\repos\
- Clone (or fork then clone) this repo using Visual Studio to the default repo folder.
git clone https://github.com/dedbeef/ok.git
- Build or run the included build once.
- Located in
bin\Debug\ok.exe
- Located in
- Clone any command plugin repo to the default repo folder.
- Build it if it does not already have binaries included.
ok
will automatically find these cloned repos and the binaries to use
- Open a command prompt or powershell window anywhere.
- Type
ok
to see all installed commands (see Installing commands above) - Run any command with the syntax that is shown beside each command.
- e.g.
ok code.cs edit BinDiff
- e.g.
-
Create your project:
- Open Visual Studio and create a new
C# Class Library (.NET Framework)
project - Note the name of the solution, project and even the class do not matter.
- I recommend renaming the ugly
Class1.cs
to something likePlugin.cs
though
- Open Visual Studio and create a new
-
Add a reference to
ok.cmd.dll
:- In the Solution Explorer, right click
References
and selectAdd Reference...
- Select the
Browse
tab, then clickBrowse...
- Navigate to
ok\ok.cmd\bin\Debug\ok.cmd.dll
and click OK, OK
- In the Solution Explorer, right click
-
Implement the plugin interface:
- e.g.
public class MyClass : ok.cmd.IOkPlugin
- (Optional) Use Visual Studio intellisense quick fix to implement the missing members
// Example plugin public class Plugin : ok.cmd.IOkPlugin { public string Command => "mycmd"; public string Description => "An example description of your command"; public string Syntax => "mycmd someArg (someOptionalArg)"; public double Version => 1.0; public bool PauseOnComplete => false; public bool RunFromSourceDirectory => false; public string SourceDirectory { get; set; } public bool Execute(params string[] args) { Console.WriteLine("Hello World"); return true; } }
- e.g.