Vixen
02b45cc4
csharp
public sealed class ConsoleContext

What a command is handed: its arguments, and somewhere to answer.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A class rather than a struct because a command may hold onto it — a command that starts something and reports later is a normal thing to want — and because the argument list has to outlive the call for that to work.

Fields and properties (5)

  • public ConsoleCommands Commands

    The registry the command was found in, so a command can call another.

  • public string Line

    The whole line as typed, the command name included.

  • public IReadOnlyList<string> Arguments

    The arguments after the command name.

  • public int Count

    How many arguments there are.

  • public string? this[int index]

    An argument, or if there are not that many.

Methods (3)

  • public void Write(string text)

    Writes a line back to whoever ran the command.

  • public bool TryNumber(int index, out float value)

    Reads an argument as a number.

  • public bool TryFlag(int index, out bool value)

    Reads an argument as on or off.

Used by (4)

  • ConsoleCommandVixen.Engine
  • ConsoleCommandsVixen.Engine
  • ConsoleTestsVixen.Engine.Tests
  • DiagnosticOverlaysVixen.Engine