Skip to content

Commit

Permalink
feat(ViewCommand): Implement IPredictable
Browse files Browse the repository at this point in the history
  • Loading branch information
Computerdores committed Apr 19, 2024
1 parent ab7917c commit c97742d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@

namespace Computerdores.AdvancedTerminalAPI.Vanillin.Commands;

public class ViewCommand : ICommand, IAliasable, IDescribable {
public class ViewCommand : ICommand, IAliasable, IDescribable, IPredictable {
public string GetName() => "view";

public string PredictInput(string partialInput, ITerminal terminal)
=> Util.FindKeyword(terminal, "view").compatibleNouns
.VanillaStringMatch(partialInput,
cn => cn.noun.word,
cn => cn.noun.defaultVerb != null
).noun.word;

/// <summary>
/// For the vanilla implementation, see: <see cref="Terminal.LoadNewNode"/>.
/// </summary>
Expand Down

0 comments on commit c97742d

Please sign in to comment.