SystemCall 9.3.0
dotnet add package SystemCall --version 9.3.0
NuGet\Install-Package SystemCall -Version 9.3.0
<PackageReference Include="SystemCall" Version="9.3.0" />
<PackageVersion Include="SystemCall" Version="9.3.0" />
<PackageReference Include="SystemCall" />
paket add SystemCall --version 9.3.0
#r "nuget: SystemCall, 9.3.0"
#:package SystemCall@9.3.0
#addin nuget:?package=SystemCall&version=9.3.0
#tool nuget:?package=SystemCall&version=9.3.0
System Call
System Call is a command-parsing .NET library inspired by Jinx and named after Sword Art Online.
It uses natural language syntax and is intended for use in command line interfaces and magic systems.
COMMAND: heal [me, everyone, player {name}] by {amount} (points)
CALL: heal player "John Doe" by 10 points
COMMAND: enhance (my) armament(!)
CALL: Enhance Armament!
Example
using SystemCall;
// Define commands
Command[] Commands = [
new("enhance_weapon", "enhance my {weapon}(!)", Call => {
return $"Weapon enhanced: {Call.GetArgument<string>("weapon")}";
}),
];
// Call commands
string.Join("\n", CommandCall.Execute("Enhance my 'Sword'!", Commands)).ShouldBe("Weapon enhanced: Sword");
Defining Commands
Commands can be defined using a format string:
Command[] Commands = [
new("enhance_weapon", "enhance my {weapon}(!)"),
];
Format strings use the following syntax:
- A sequence of tokens in brackets may be entirely omitted:
(optional tokens) - A token in curly brackets is the name of an argument:
{username} - A list of sequences of tokens in square brackets is a list of choices:
[vanilla, chocolate, strawberry and cream] - Any token can be escaped with a backslash:
not a bracket \(
Alternatively, commands can be manually constructed:
Command[] Commands = [
new("enhance_weapon", [
new CommandLiteralComponent("enhance my"),
new CommandArgumentComponent("weapon"),
new CommandOptionalComponent([
new CommandLiteralComponent("!"),
]),
]),
];
Calling Commands
Calls can be parsed using an input string:
List<CommandCall> Calls = CommandCall.ParseAll("enhance my 'Sword'!", Commands);
Calls use the following syntax:
- Each call is separated by newlines or semicolons:
eat me; drink me - Any token can be escaped with a backslash:
not a bracket \(
Alternatively, calls can be parsed and executed, returning a result:
List<object?> Outputs = CommandCall.Execute("Enhance my 'Sword'!", Commands);
Arguments are parsed as JSONH, which is a superset of JSON.
If a call is ambiguous between multiple commands, the first command is prioritized.
Known Bugs/Limitations
Optional arguments must have a leading/trailing token
In the following example, object is an optional argument:
eat ({object}) please
However, calling eat please will not match the command.
The reason is that please is parsed as the optional object argument rather than the token.
This is a current limitation with the System Call parser that may be fixed in the future.
The current workaround is to add another token within the brackets:
eat (the {object}) please
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- JsonhCs (>= 3.14.0)
- LinkDotNet.StringBuilder (>= 3.2.0)
-
net9.0
- JsonhCs (>= 3.14.0)
- LinkDotNet.StringBuilder (>= 3.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.3.0 | 134 | 11/2/2025 |
| 9.2.0 | 132 | 10/13/2025 |
| 9.1.0 | 482 | 7/24/2025 |
| 9.0.0 | 132 | 7/15/2025 |
| 8.1.0 | 173 | 5/1/2025 |
| 8.0.0 | 147 | 3/30/2025 |
| 7.2.0 | 472 | 3/25/2025 |
| 7.1.0 | 148 | 3/20/2025 |
| 7.0.0 | 143 | 3/19/2025 |
| 6.0.0 | 151 | 3/15/2025 |
| 5.3.0 | 134 | 3/9/2025 |
| 5.2.0 | 105 | 1/26/2025 |
| 5.1.0 | 93 | 1/25/2025 |
| 5.0.0 | 87 | 1/24/2025 |
| 4.0.0 | 92 | 1/24/2025 |
| 3.0.0 | 98 | 1/23/2025 |
| 2.1.0 | 80 | 1/17/2025 |
| 2.0.0 | 88 | 1/17/2025 |
| 1.2.0 | 107 | 11/24/2024 |
| 1.1.0 | 100 | 11/24/2024 |
| 1.0.0 | 106 | 11/13/2024 |