Skip to content
149 changes: 0 additions & 149 deletions src/cli/cli_params.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from enum import Enum
from typing import Annotated

import questionary
from typer import Argument, Option

from cli.multi_option import MultiOption
Expand Down Expand Up @@ -103,151 +102,3 @@ class DebugBinary(str, Enum):
AnsiblePlaybook = Annotated[
str, Option("-ap", "--ansible_playbook", help="Ansible playbook name")
]


# ---------------------------------------------------------------------------
# Interactive CLI styling
#
# Shared questionary style applied to every interactive prompt. The highlighted
# (pointed-at) option is rendered in bold cyan so it stands out, while the other
# rows are dimmed. questionary draws the per-option description on a line at the
# bottom of the prompt using the same "text" class as the unselected rows, so it
# inherits the dim styling and is distinguished by its "Description:" label and
# position. Colours use ANSI names so they adapt to the user's terminal theme.
# ---------------------------------------------------------------------------
INTERACTIVE_STYLE = questionary.Style(
[
("qmark", "fg:ansicyan bold"),
("question", "bold"),
("pointer", "fg:ansicyan bold"),
("highlighted", "fg:ansicyan bold"),
("selected", "fg:ansigreen"),
("answer", "fg:ansicyan bold"),
("text", "fg:ansibrightblack"),
("instruction", "fg:ansibrightblack italic"),
("disabled", "fg:ansibrightblack italic"),
]
)


# ---------------------------------------------------------------------------
# Interactive CLI choices
#
# Each questionary.Choice pairs an option's display title with a description.
# questionary renders the description inline when the option is highlighted in
# the interactive menus, giving users guidance without leaving the prompt.
# When a Choice has no explicit value, questionary returns its title, so the
# titles below double as the values consumed by start_interactive_cli.
# ---------------------------------------------------------------------------

# Top-level "What would you like to do?" menu.
CATEGORY_CHOICES = [
questionary.Choice(
title="Run thunderscope",
description="Launch Thunderscope against the simulator or real robots",
),
questionary.Choice(
title="Test",
description="Run a single test or the entire test suite",
),
questionary.Choice(
title="Flash",
description="Deploy software or firmware to a robot via Ansible",
),
]

# Thunderscope "Launch mode?" menu.
LAUNCH_MODE_CHOICES = [
questionary.Choice(
title="Simulator",
description="Run Thunderscope against the simulated full system",
),
questionary.Choice(
title="Diagnostics",
description="Run Thunderscope in diagnostics mode against real robots",
),
questionary.Choice(
title="Run blue",
description="run_blue",
),
questionary.Choice(
title="Run yellow",
description="run_yellow",
),
]

# Thunderscope simulator "Options:" checkbox.
THUNDERSCOPE_SIMULATOR_OPTION_CHOICES = [
questionary.Choice(
title="enable_autoref",
description="Run the autoref alongside the simulator",
),
questionary.Choice(
title="ci_mode",
description="Run in continuous integration mode (headless friendly)",
),
questionary.Choice(
title="record_stats",
description="Record gameplay statistics for a given duration in minutes",
),
questionary.Choice(
title="enable_realism",
description="Enable realistic simulation physics and sensor noise",
),
questionary.Choice(
title="enable_autogc",
description="Run the automated game controller alongside the simulator",
),
]

# Deploy robot software "Options:" checkbox. Each option compiles Thunderloop
# with a preprocessor flag that disables the corresponding service, letting
# Thunderloop run on a robot whose powerboard or motorboard is unavailable.
DEPLOY_ROBOT_SOFTWARE_OPTION_CHOICES = [
questionary.Choice(
title="DISABLE_POWER_SERVICE",
description="Compile Thunderloop without the Power Service (no powerboard)",
),
questionary.Choice(
title="DISABLE_MOTOR_SERVICE",
description="Compile Thunderloop without the Motor Service (no motorboard)",
),
]

# Marker value returned by the DEBUG_POWERLOOP playbook choice. It maps to the
# deploy_powerboard.yml playbook but additionally compiles powerloop_main with
# the DEBUG_POWERLOOP flag, swapping in bare setup()/loop() stubs so arbitrary
# code can be flashed onto the powerboard microcontroller for debugging.
DEBUG_POWERLOOP_PLAYBOOK = "deploy_powerboard.yml (DEBUG_POWERLOOP)"

# Flash "Select playbook:" menu.
PLAYBOOK_CHOICES = [
questionary.Choice(
title="setup_pi.yml",
description="First-time setup of the Raspberry Pi on a robot",
),
questionary.Choice(
title="deploy_robot_software.yml",
description="Build and flash Thunderloop and the robot software",
),
questionary.Choice(
title="deploy_powerboard.yml",
description="Flash the powerboard firmware (powerloop_main)",
),
questionary.Choice(
title=DEBUG_POWERLOOP_PLAYBOOK,
description="Flash powerloop_main built with the DEBUG_POWERLOOP flag "
"for inserting arbitrary debug code onto the powerboard",
),
questionary.Choice(
title="deploy_motor_firmware.yml",
description="Flash the motor controller firmware",
),
]


THUNDERSCOPE_OPTIONS_MAP = {
"Diagnostics": "run_diagnostics",
"Run blue": "run_blue",
"Run yellow": "run_yellow",
}
Loading
Loading