Package-level declarations

Overview

Hosts the CLI loop, command parsing and rendering utilities. The CLI is designed to be minimal and driven by plain standard input/output which makes it easy to script and test.

Key Components

  • CLI — Main CLI coordinator class managing the REPL loop

  • CliConfig — Configuration for CLI appearance (colors, prompts, messages)

  • Environment — Constants for CLI-specific paths and settings

  • Main — Entry point for the CLI application

Responsibilities

  • Providing an interactive command-line interface for the Reversi game

  • Managing the REPL (Read-Eval-Print Loop)

  • Parsing and dispatching commands

  • Maintaining game context across command executions

  • Rendering game state to the console

  • Loading CLI configuration from properties file

Types

Link copied to clipboard
class CLI(val commands: Array<CommandImpl<Game>>, val debug: Boolean = false, debugCommands: Array<CommandImpl<Game>> = arrayOf())

Simple command-line interface coordinator.

Link copied to clipboard
class CliConfig(val map: Map<String, String>) : Config

Configuration holder for CLI-specific settings including welcome messages and text colors. Manages display colors for different message types and command prompt styling.

Properties

Link copied to clipboard
val allCommands: Array<CommandImpl<Game>>
Link copied to clipboard

Global CLI configuration loaded from the CLI configuration file. Contains all theme colors, prompts, and text settings for the command-line interface.

Link copied to clipboard
private val debugArg: CommandArg

Command-line arguments: debug flag enables internal debug commands and extra diagnostics.

Link copied to clipboard
val debugCommands: Array<CommandImpl<Game>>
Link copied to clipboard

ANSI color code for error messages.

Link copied to clipboard

ANSI color code for help command aliases.

Link copied to clipboard

ANSI color code for help command descriptions.

Link copied to clipboard

ANSI color code for help command usage text.

Link copied to clipboard

ANSI color code for informational messages.

Link copied to clipboard
Link copied to clipboard

Command prompt string displayed to the user.

Link copied to clipboard

ANSI color code for the command prompt.

Link copied to clipboard

ANSI color code for regular text output.

Link copied to clipboard

ANSI color code for warning messages.

Link copied to clipboard

Welcome message displayed when the CLI starts.

Functions

Link copied to clipboard
fun main(args: Array<String>)

Main entry point for the Reversi CLI application. It configures the available commands and starts the interactive loop.