diff --git a/cmd/config/cmd.go b/cmd/config/cmd.go index 7c3c2824..73bc30b7 100644 --- a/cmd/config/cmd.go +++ b/cmd/config/cmd.go @@ -2,10 +2,6 @@ package config import "forge.lthn.ai/core/go/pkg/cli" -func init() { - cli.RegisterCommands(AddConfigCommands) -} - // AddConfigCommands registers the 'config' command group and all subcommands. func AddConfigCommands(root *cli.Command) { configCmd := cli.NewGroup("config", "Manage configuration", "") diff --git a/cmd/doctor/cmd_commands.go b/cmd/doctor/cmd_commands.go index b97d1870..0bd07e94 100644 --- a/cmd/doctor/cmd_commands.go +++ b/cmd/doctor/cmd_commands.go @@ -10,14 +10,7 @@ // Provides platform-specific installation instructions for missing tools. package doctor -import ( - "forge.lthn.ai/core/go/pkg/cli" - "github.com/spf13/cobra" -) - -func init() { - cli.RegisterCommands(AddDoctorCommands) -} +import "github.com/spf13/cobra" // AddDoctorCommands registers the 'doctor' command and all subcommands. func AddDoctorCommands(root *cobra.Command) { diff --git a/cmd/help/cmd.go b/cmd/help/cmd.go index 45c9f638..4d429cea 100644 --- a/cmd/help/cmd.go +++ b/cmd/help/cmd.go @@ -7,10 +7,6 @@ import ( "forge.lthn.ai/core/go/pkg/help" ) -func init() { - cli.RegisterCommands(AddHelpCommands) -} - func AddHelpCommands(root *cli.Command) { var searchFlag string diff --git a/cmd/module/cmd.go b/cmd/module/cmd.go index 3cf2b2e0..c6e7cccc 100644 --- a/cmd/module/cmd.go +++ b/cmd/module/cmd.go @@ -17,10 +17,6 @@ import ( "forge.lthn.ai/core/go/pkg/store" ) -func init() { - cli.RegisterCommands(AddModuleCommands) -} - // AddModuleCommands registers the 'module' command and all subcommands. func AddModuleCommands(root *cli.Command) { moduleCmd := &cli.Command{ diff --git a/cmd/pkgcmd/cmd_pkg.go b/cmd/pkgcmd/cmd_pkg.go index c25cd055..184bcff8 100644 --- a/cmd/pkgcmd/cmd_pkg.go +++ b/cmd/pkgcmd/cmd_pkg.go @@ -7,10 +7,6 @@ import ( "github.com/spf13/cobra" ) -func init() { - cli.RegisterCommands(AddPkgCommands) -} - // Style and utility aliases var ( repoNameStyle = cli.RepoStyle diff --git a/cmd/plugin/cmd.go b/cmd/plugin/cmd.go index 24fa42c2..68558e82 100644 --- a/cmd/plugin/cmd.go +++ b/cmd/plugin/cmd.go @@ -13,10 +13,6 @@ import ( "forge.lthn.ai/core/go/pkg/i18n" ) -func init() { - cli.RegisterCommands(AddPluginCommands) -} - // AddPluginCommands registers the 'plugin' command and all subcommands. func AddPluginCommands(root *cli.Command) { pluginCmd := &cli.Command{ diff --git a/cmd/session/cmd_session.go b/cmd/session/cmd_session.go index caa49984..08014119 100644 --- a/cmd/session/cmd_session.go +++ b/cmd/session/cmd_session.go @@ -11,10 +11,6 @@ import ( "forge.lthn.ai/core/go/pkg/session" ) -func init() { - cli.RegisterCommands(AddSessionCommands) -} - // AddSessionCommands registers the 'session' command group. func AddSessionCommands(root *cli.Command) { sessionCmd := &cli.Command{ diff --git a/go.mod b/go.mod index 3906ca4a..512dc8b8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module forge.lthn.ai/core/cli go 1.26.0 require ( - forge.lthn.ai/core/go v0.0.0-20260221191103-d091fa62023f + forge.lthn.ai/core/go v0.0.0-20260221220640-2a90ae65b7c7 forge.lthn.ai/core/go-crypt v0.0.0-20260221193816-fde12e1539b2 // indirect ) diff --git a/go.sum b/go.sum index b50cdfda..b5374a38 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ forge.lthn.ai/core/go v0.0.0-20260221191103-d091fa62023f h1:CcSh/FFY93K5m0vADHLxwxKn2pTIM8HzYX1eGa4WZf4= forge.lthn.ai/core/go v0.0.0-20260221191103-d091fa62023f/go.mod h1:WCPJVEZm/6mTcJimHV0uX8ZhnKEF3dN0rQp13ByaSPg= +forge.lthn.ai/core/go v0.0.0-20260221220640-2a90ae65b7c7 h1:UhlJo4QeqKD0IM0wKjOh8H3OaDnvdl5m7psozRXJdO8= +forge.lthn.ai/core/go v0.0.0-20260221220640-2a90ae65b7c7/go.mod h1:WCPJVEZm/6mTcJimHV0uX8ZhnKEF3dN0rQp13ByaSPg= forge.lthn.ai/core/go-crypt v0.0.0-20260221193816-fde12e1539b2 h1:2eXqQXF+1AyitPJox9Yjewb6w8fO0JHFw7gPqk8WqIM= forge.lthn.ai/core/go-crypt v0.0.0-20260221193816-fde12e1539b2/go.mod h1:o4vkJgoT9u+r7DR42LIJHW6L5vMS3Au8gaaCA5Cved0= github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= diff --git a/main.go b/main.go index bb32470f..2bb5989d 100644 --- a/main.go +++ b/main.go @@ -1,17 +1,24 @@ package main import ( + "forge.lthn.ai/core/cli/cmd/config" + "forge.lthn.ai/core/cli/cmd/doctor" + "forge.lthn.ai/core/cli/cmd/help" + "forge.lthn.ai/core/cli/cmd/module" + "forge.lthn.ai/core/cli/cmd/pkgcmd" + "forge.lthn.ai/core/cli/cmd/plugin" + "forge.lthn.ai/core/cli/cmd/session" "forge.lthn.ai/core/go/pkg/cli" - - _ "forge.lthn.ai/core/cli/cmd/config" - _ "forge.lthn.ai/core/cli/cmd/doctor" - _ "forge.lthn.ai/core/cli/cmd/help" - _ "forge.lthn.ai/core/cli/cmd/module" - _ "forge.lthn.ai/core/cli/cmd/pkgcmd" - _ "forge.lthn.ai/core/cli/cmd/plugin" - _ "forge.lthn.ai/core/cli/cmd/session" ) func main() { - cli.Main() + cli.Main( + cli.WithCommands("config", config.AddConfigCommands), + cli.WithCommands("doctor", doctor.AddDoctorCommands), + cli.WithCommands("help", help.AddHelpCommands), + cli.WithCommands("module", module.AddModuleCommands), + cli.WithCommands("pkg", pkgcmd.AddPkgCommands), + cli.WithCommands("plugin", plugin.AddPluginCommands), + cli.WithCommands("session", session.AddSessionCommands), + ) }