cli/cmd/core/config/cmd_get.go
Snider 21dc508e96
Some checks are pending
Security Scan / security (push) Waiting to run
refactor(cli): replace cobra with core/go primitives
- Remove github.com/spf13/cobra dependency entirely
- Command = core.Command (was cobra.Command)
- CommandRegistration func(c *core.Core) (was func(root *cobra.Command))
- Path-based routing: c.Command("config/list", ...) replaces root.AddCommand()
- Flags parsed automatically via core.Options (no StringVarP ceremony)
- Replace stdlib imports with core/go: errors, path/filepath fully removed
- fmt/strings reduced to only what core/go can't replace yet (Fprint, Builder)
- Shell completion deferred to core/go v0.9.0
- Net -344 lines (576 insertions, 920 deletions)
- Build, vet, and tests pass clean

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 11:11:25 +01:00

26 lines
581 B
Go

package config
import (
"dappco.re/go/core"
"dappco.re/go/core/cli/pkg/cli"
)
func configGetAction(opts core.Options) core.Result {
key := opts.String("_arg")
if key == "" {
return core.Result{Value: cli.Err("requires a configuration key argument"), OK: false}
}
configuration, err := loadConfig()
if err != nil {
return core.Result{Value: err, OK: false}
}
var value any
if err := configuration.Get(key, &value); err != nil {
return core.Result{Value: cli.Err("key not found: %s", key), OK: false}
}
cli.Println("%v", value)
return core.Result{OK: true}
}