feat: add yaml config support

This commit is contained in:
loveuer
2025-03-20 11:55:47 +08:00
parent 32b30ae183
commit 2e13671bb7
9 changed files with 139 additions and 145 deletions

View File

@ -10,8 +10,15 @@ import (
"ultone/internal/unix"
)
var (
cliCommand = &cobra.Command{
var ()
func initCli() *cobra.Command {
var (
svc string
cliClient *rpc.Client
)
cmd := &cobra.Command{
Use: "cli",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
log.Debug(cmd.Context(), "[cmd.cli] svc address: %s", svc)
@ -34,13 +41,8 @@ var (
},
}
svc string
cliClient *rpc.Client
)
func initCli() {
cliCommand.PersistentFlags().StringVar(&svc, "svc", opt.RpcAddress, "server unix listen address")
cliCommand.AddCommand(&cobra.Command{
cmd.PersistentFlags().StringVar(&svc, "svc", opt.RpcAddress, "server unix listen address")
cmd.AddCommand(&cobra.Command{
Use: "set",
RunE: func(cmd *cobra.Command, args []string) (err error) {
log.Debug(cmd.Context(), "[cli.set] all args: %v", args)
@ -73,4 +75,6 @@ func initCli() {
return nil
},
})
return cmd
}