core/cli is now a pure library (pkg/cli). The binary moves to cmd/core/ as a separate sub-module with its own go.mod. Removed from binary: gocmd (→ lint/go-build), service (→ go-process), session (→ go-session), module (→ go-scm), plugin (→ go-scm). Removed from framework: go-crypt, workspace, daemon_cmd. Root go.mod: 1 direct forge dep (core/go). Cross-compiles CGO_ENABLED=0. Co-Authored-By: Virgil <virgil@lethean.io>
25 lines
579 B
Go
25 lines
579 B
Go
package config
|
|
|
|
import (
|
|
"forge.lthn.ai/core/cli/pkg/cli"
|
|
"forge.lthn.ai/core/config"
|
|
)
|
|
|
|
// AddConfigCommands registers the 'config' command group and all subcommands.
|
|
func AddConfigCommands(root *cli.Command) {
|
|
configCmd := cli.NewGroup("config", "Manage configuration", "")
|
|
root.AddCommand(configCmd)
|
|
|
|
addGetCommand(configCmd)
|
|
addSetCommand(configCmd)
|
|
addListCommand(configCmd)
|
|
addPathCommand(configCmd)
|
|
}
|
|
|
|
func loadConfig() (*config.Config, error) {
|
|
cfg, err := config.New()
|
|
if err != nil {
|
|
return nil, cli.Wrap(err, "failed to load config")
|
|
}
|
|
return cfg, nil
|
|
}
|