1- import sys
21import asyncio
32import json
4- import typer
53import logging
4+
5+ import typer
66from rich .console import Console
77from rich .theme import Theme
88
9- from antares import ShipConfig , AntaresClient
9+ from antares import AntaresClient , ShipConfig
1010from antares .config_loader import load_config
11- from antares .errors import (
12- ConnectionError ,
13- SimulationError ,
14- SubscriptionError
15- )
11+ from antares .errors import ConnectionError , SimulationError , SubscriptionError
1612from antares .logger import setup_logging
1713
18- app = typer .Typer (name = "antares" , help = "Antares CLI for ship simulation" )
19- console = Console (theme = Theme ({
20- "info" : "green" ,
21- "warn" : "yellow" ,
22- "error" : "bold red"
23- }))
14+ app = typer .Typer (name = "antares" , help = "Antares CLI for ship simulation" , no_args_is_help = True )
15+ console = Console (theme = Theme ({"info" : "green" , "warn" : "yellow" , "error" : "bold red" }))
2416
2517
2618def handle_error (message : str , code : int , json_output : bool = False ):
@@ -57,7 +49,7 @@ def build_client(config_path: str | None, verbose: bool, json_output: bool) -> A
5749def reset (
5850 config : str = typer .Option (None ),
5951 verbose : bool = typer .Option (False , "--verbose" , "-v" ),
60- json_output : bool = typer .Option (False , "--json" , help = "Output in JSON format" )
52+ json_output : bool = typer .Option (False , "--json" , help = "Output in JSON format" ),
6153):
6254 client = build_client (config , verbose , json_output )
6355 try :
@@ -70,11 +62,11 @@ def reset(
7062
7163@app .command ()
7264def add_ship (
73- x : float ,
74- y : float ,
75- config : str = typer .Option (None ),
76- verbose : bool = typer .Option (False , "--verbose" , "-v" ),
77- json_output : bool = typer .Option (False , "--json" , help = "Output in JSON format" )
65+ x : float = typer . Option (..., help = "X coordinate of the ship" ) ,
66+ y : float = typer . Option (..., help = "Y coordinate of the ship" ) ,
67+ config : str = typer .Option (None , help = "Path to the configuration file" ),
68+ verbose : bool = typer .Option (False , "--verbose" , "-v" , help = "Enable verbose output" ),
69+ json_output : bool = typer .Option (False , "--json" , help = "Output in JSON format" ),
7870):
7971 client = build_client (config , verbose , json_output )
8072 try :
@@ -91,7 +83,7 @@ def subscribe(
9183 config : str = typer .Option (None ),
9284 verbose : bool = typer .Option (False , "--verbose" , "-v" ),
9385 json_output : bool = typer .Option (False , "--json" , help = "Output in JSON format" ),
94- log_file : str = typer .Option ("antares.log" , help = "Path to log file" )
86+ log_file : str = typer .Option ("antares.log" , help = "Path to log file" ),
9587):
9688 setup_logging (log_file = log_file , level = logging .DEBUG if verbose else logging .INFO )
9789 logger = logging .getLogger ("antares.cli" )
0 commit comments