Add initial implementation of cobot CLI and setup scripts
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import argparse
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
from cobot.commands import setup as cmd_setup
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="cobot",
|
||||
description="Lightweight Cobot - Cobot ROS2 Control Framework",
|
||||
)
|
||||
subparsers = parser.add_subparsers(dest="command", metavar="<command>")
|
||||
subparsers.required = True
|
||||
|
||||
# Регистрируем подкоманды — каждый модуль в cobot/commands/ описывает свою
|
||||
_register_commands(subparsers)
|
||||
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
|
||||
|
||||
def _register_commands(subparsers):
|
||||
cmd_setup.register(subparsers)
|
||||
@@ -0,0 +1,10 @@
|
||||
import argparse
|
||||
|
||||
|
||||
def register(subparsers):
|
||||
p = subparsers.add_parser("setup", help="First-time project setup")
|
||||
p.set_defaults(func=run)
|
||||
|
||||
|
||||
def run(args: argparse.Namespace) -> None:
|
||||
print("cobot setup — TODO: implement setup logic here")
|
||||
Reference in New Issue
Block a user