Skip to content

Commit 5354b78

Browse files
Fix CLI command structure to avoid double nesting
- Register individual command functions directly instead of Typer apps - This fixes the issue where commands required double nesting (e.g. 'codegen init init') - Now commands work as expected: 'codegen init', 'codegen login', etc. - Config command remains as a Typer app since it has subcommands
1 parent 0ee0a78 commit 5354b78

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/codegen/cli/cli.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,23 @@
1919
rich_markup_mode="rich"
2020
)
2121

22-
# Add commands to the main app
23-
main.add_typer(init_command, name="init")
24-
main.add_typer(logout_command, name="logout")
25-
main.add_typer(login_command, name="login")
26-
main.add_typer(profile_command, name="profile")
27-
main.add_typer(style_debug_command, name="style-debug")
28-
main.add_typer(update_command, name="update")
22+
# Import the actual command functions
23+
from codegen.cli.commands.init.main import init
24+
from codegen.cli.commands.login.main import login
25+
from codegen.cli.commands.logout.main import logout
26+
from codegen.cli.commands.profile.main import profile
27+
from codegen.cli.commands.style_debug.main import style_debug
28+
from codegen.cli.commands.update.main import update
29+
30+
# Add individual commands to the main app
31+
main.command("init")(init)
32+
main.command("login")(login)
33+
main.command("logout")(logout)
34+
main.command("profile")(profile)
35+
main.command("style-debug")(style_debug)
36+
main.command("update")(update)
37+
38+
# Config is a group, so add it as a typer
2939
main.add_typer(config_command, name="config")
3040

3141

0 commit comments

Comments
 (0)