pyfcstm.entry.simulate.commands

Command processor for the simulation REPL.

This module provides command parsing and execution for the interactive state machine simulator.

LogLevel

class pyfcstm.entry.simulate.commands.LogLevel(value)[source]

Log level enumeration for controlling output verbosity.

Variables:
  • DEBUG – Show all messages including debug information

  • INFO – Show informational messages and above

  • WARNING – Show warnings and errors only

  • ERROR – Show errors only

  • OFF – Disable all logging

Settings

class pyfcstm.entry.simulate.commands.Settings[source]

Runtime settings for the simulator.

Variables:
  • table_max_rows (int) – Maximum rows to display in tables before truncating

  • history_size (int) – Maximum number of history entries to keep

  • color (bool) – Whether to use ANSI colors

  • log_level (LogLevel) – Current log level

__init__()[source]

Initialize settings with default values.

get(key: str) Any[source]

Get a setting value.

Parameters:

key (str) – Setting key

Returns:

Setting value

Return type:

Any

Raises:

KeyError – If key doesn’t exist

list_all() Dict[str, Any][source]

Get all settings as a dictionary.

Returns:

Dictionary of all settings

Return type:

Dict[str, Any]

set(key: str, value: Any) None[source]

Set a setting value.

Parameters:
  • key (str) – Setting key

  • value (Any) – Setting value

Raises:
  • KeyError – If key doesn’t exist

  • ValueError – If value is invalid

CommandResult

class pyfcstm.entry.simulate.commands.CommandResult(output: str, should_exit: bool = False)[source]

Result of a command execution.

Parameters:
  • output (str) – The output text to display to the user

  • should_exit (bool) – Whether the REPL should exit after this command

CommandProcessor

class pyfcstm.entry.simulate.commands.CommandProcessor(runtime, state_machine=None, use_color: bool = True)[source]

Processor for handling interactive commands.

This class routes commands to their handlers and manages command execution state including log level.

Parameters:

runtime (SimulationRuntime) – The simulation runtime instance

Variables:
__init__(runtime, state_machine=None, use_color: bool = True)[source]

Initialize the command processor.

Parameters:
  • runtime (SimulationRuntime) – The simulation runtime instance

  • state_machine (StateMachine, optional) – The state machine model (required for init command)

  • use_color (bool, optional) – Whether to use ANSI colors, defaults to True

process(user_input: str) CommandResult[source]

Process a user command.

Parameters:

user_input (str) – The raw user input string

Returns:

Command execution result

Return type:

CommandResult