Files
UniversalTrain-ai/rl/mjlab/scripts/_cli.py
T
chenlin c32df70326
Checks / Layout, translation and Colab checks (push) Has been cancelled
Checks / Ruff (push) Has been cancelled
Checks / Framework tests (native backend, CPU) (push) Has been cancelled
Checks / Portable Rust controller (push) Has been cancelled
release: v0.1 generic robot training and application platform
2026-11-05 11:05:01 +08:00

19 lines
650 B
Python

"""Shared helpers for CLI entrypoints."""
import sys
def maybe_print_top_level_help(prog: str) -> None:
"""Print a top-level usage message and exit if argv is bare -h/--help.
The ``train`` and ``play`` entrypoints use a two-stage tyro parse with
``add_help=False`` on the first stage, so ``prog --help`` otherwise
produces no output. This handles that case explicitly.
"""
if len(sys.argv) >= 2 and sys.argv[1] in ("-h", "--help"):
print(f"usage: {prog} <TASK> [OPTIONS]")
print()
print(f"Run '{prog} <TASK> --help' for task-specific options.")
print("Run 'uv run list-envs' to list available tasks.")
sys.exit(0)