Skip to content

Commit

Permalink
Restore old functions load
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonghi committed Jan 21, 2025
1 parent 96b0c88 commit 773ece8
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/nanosaur/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,19 @@ def main():
# Parse the arguments
args = parser.parse_args()

# Handle subcommands without a specific type
subcommand_map = {
'workspace': parser_workspace,
'ws': parser_workspace,
'simulation': parser_simulation,
'sim': parser_simulation,
'robot': parser_robot,
'swarm': parser_swarm
}

if args.command in subcommand_map and getattr(args, f"{args.command}_type", None) is None:
subcommand_map[args.command].print_help()
# Handle workspace subcommand without a workspace_type
if args.command in ['workspace', 'ws'] and args.workspace_type is None:
parser_workspace.print_help()
sys.exit(1)
# Handle install subcommand without an install_type
if args.command in ['simulation', 'sim'] and args.simulation_type is None:
parser_simulation.print_help()
sys.exit(1)
if args.command in ['robot'] and args.robot_type is None:
parser_robot.print_help()
sys.exit(1)
if args.command in ['swarm'] and args.swarm_type is None:
parser_swarm.print_help()
sys.exit(1)

# Execute the corresponding function based on the subcommand
Expand Down

0 comments on commit 773ece8

Please sign in to comment.