Skip to content

Commit

Permalink
fix!: Change naming in IPredictable API to clearly convey that not ju…
Browse files Browse the repository at this point in the history
…st arguments but also Input should be predicted
  • Loading branch information
Computerdores committed Apr 3, 2024
1 parent d8ceb51 commit ab52e49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion AdvancedTerminalAPI/IPredictable.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace Computerdores;

public interface IPredictable {
public string PredictArguments(string partialArgumentsText);
public string PredictInput(string partialInput);
}
6 changes: 3 additions & 3 deletions AdvancedTerminalAPI/Vanillin/SwitchCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
public class SwitchCommand : SimpleCommand, ICommand, IPredictable {
public string GetName() => "switch";

public string PredictArguments(string partialArgumentsText) { // untested
int index = Util.GetPlayerIndexByName(partialArgumentsText);
return index != -1 ? StartOfRound.Instance.mapScreen.radarTargets[index].name : partialArgumentsText;
public string PredictInput(string partialInput) { // untested
int index = Util.GetPlayerIndexByName(partialInput);
return index != -1 ? StartOfRound.Instance.mapScreen.radarTargets[index].name : partialInput;
}

protected override CommandResult Execute(string input, ITerminal terminal) {
Expand Down
12 changes: 12 additions & 0 deletions AdvancedTerminalAPI/Vanillin/TestCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Computerdores.Vanillin;

public class TestCommand : SimpleCommand, ICommand {

public string GetName() => "test";

protected override CommandResult Execute(string input, ITerminal terminal) {
return new CommandResult("test!\n", false, true);
}

public object Clone() => new TestCommand();
}
2 changes: 1 addition & 1 deletion AdvancedTerminalAPI/Vanillin/ViewCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Computerdores.Vanillin;
public class ViewCommand : SimpleCommand, ICommand, IPredictable {
public string GetName() => "view";

public string PredictArguments(string partialArgumentsText) {
public string PredictInput(string partialInput) {
throw new System.NotImplementedException(); // TODO
}

Expand Down

0 comments on commit ab52e49

Please sign in to comment.