Skip to content

Commit

Permalink
chore: cleanup root
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Dec 21, 2023
1 parent 9ec535f commit 4e7da28
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gno.land/cmd/gnokey/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
Remote: "127.0.0.1:26657",
}

cmd := client.NewRootCmdWithBaseConfig(commands.NewDefaultIO(), baseCfg)
cmd := NewRoot(commands.NewDefaultIO(), baseCfg)
if err := cmd.ParseAndRun(context.Background(), os.Args[1:]); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%+v\n", err)

Expand Down
46 changes: 46 additions & 0 deletions gno.land/cmd/gnokey/root.go
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
// Dedicated to my love, Lexi.
package main

import (
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"

"github.com/peterbourgon/ff/v3"
"github.com/peterbourgon/ff/v3/fftoml"
)

func NewRoot(io commands.IO, base client.BaseOptions) *commands.Command {
cfg := &client.BaseCfg{
BaseOptions: base,
}

cmd := commands.NewCommand(
commands.Metadata{
ShortUsage: "<subcommand> [flags] [<arg>...]",
LongHelp: "Manages private keys for the node",
Options: []ff.Option{
ff.WithConfigFileFlag("config"),
ff.WithConfigFileParser(fftoml.Parser),
},
},
cfg,
commands.HelpExec,
)

cmd.AddSubCommands(
client.NewAddCmd(cfg, io),
client.NewDeleteCmd(cfg, io),
client.NewGenerateCmd(cfg, io),
client.NewExportCmd(cfg, io),
client.NewImportCmd(cfg, io),
client.NewListCmd(cfg, io),
client.NewSignCmd(cfg, io),
client.NewVerifyCmd(cfg, io),
client.NewQueryCmd(cfg, io),
client.NewBroadcastCmd(cfg, io),

// Use custom MakeTX command
NewMakeTxCmd(cfg, io),
)

return cmd
}

0 comments on commit 4e7da28

Please sign in to comment.