G
2025-12-09 12:40:55 -05:00
|
|
|
"""
|
G
2025-12-09 12:51:16 -05:00
|
|
|
This module contains the main group for the ria toolkit oss CLI.
|
G
2025-12-09 12:40:55 -05:00
|
|
|
"""
|
|
|
|
|
|
2026-06-03 16:25:47 -04:00
|
|
|
import subprocess
|
|
|
|
|
import sys
|
|
|
|
|
|
G
2025-12-09 12:40:55 -05:00
|
|
|
import click
|
|
|
|
|
|
G
2025-12-15 13:51:17 -05:00
|
|
|
from ria_toolkit_oss_cli.ria_toolkit_oss import commands
|
G
2025-12-09 12:40:55 -05:00
|
|
|
|
|
|
|
|
|
2026-06-03 16:25:47 -04:00
|
|
|
def _git_lfs_installed() -> bool:
|
|
|
|
|
"""Return True if git-lfs is available on PATH."""
|
|
|
|
|
try:
|
|
|
|
|
return subprocess.run(
|
|
|
|
|
["git", "lfs", "version"],
|
|
|
|
|
capture_output=True,
|
|
|
|
|
).returncode == 0
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
G
2025-12-09 12:40:55 -05:00
|
|
|
@click.group()
|
|
|
|
|
@click.option("-v", "--verbose", is_flag=True, type=bool, help="Increase verbosity, especially useful for debugging.")
|
|
|
|
|
def cli(verbose):
|
2026-06-03 16:25:47 -04:00
|
|
|
if not _git_lfs_installed():
|
|
|
|
|
click.echo(
|
|
|
|
|
"Warning: git-lfs is not installed. RIA Hub projects require git-lfs to\n"
|
|
|
|
|
"track large binary files (models, recordings, datasets).\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" Linux: sudo apt-get install git-lfs\n"
|
|
|
|
|
" macOS: brew install git-lfs\n"
|
|
|
|
|
" Other platforms: https://git-lfs.com\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"After installing, run: git lfs install",
|
|
|
|
|
err=True,
|
|
|
|
|
)
|
G
2025-12-09 12:40:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Loop through project commands, binding them all to the CLI.
|
|
|
|
|
for command_name in dir(commands):
|
|
|
|
|
command = getattr(commands, command_name)
|
|
|
|
|
if isinstance(command, click.Command):
|
|
|
|
|
cli.add_command(command, name=command_name)
|