From a1a68d280843b4bb68d65c841ff0ab8a5a0e4358 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Thu, 5 May 2022 22:59:35 -0300 Subject: [PATCH] refactor: switch to cobra it does not come with a lot of unused deps anymore, so we can switch back to it instead of coral. Signed-off-by: Carlos A Becker --- cmd/melt/main.go | 24 ++++++++++++------------ go.mod | 4 ++-- go.sum | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cmd/melt/main.go b/cmd/melt/main.go index 64d8150..b6e9555 100644 --- a/cmd/melt/main.go +++ b/cmd/melt/main.go @@ -15,11 +15,11 @@ import ( "github.com/charmbracelet/melt" "github.com/mattn/go-isatty" "github.com/mattn/go-tty" - "github.com/muesli/coral" - mcoral "github.com/muesli/mango-coral" + mcobra "github.com/muesli/mango-cobra" "github.com/muesli/reflow/wordwrap" "github.com/muesli/roff" "github.com/muesli/termenv" + "github.com/spf13/cobra" "github.com/tyler-smith/go-bip39" "github.com/tyler-smith/go-bip39/wordlists" "golang.org/x/crypto/ssh" @@ -48,7 +48,7 @@ var ( mnemonic string language string - rootCmd = &coral.Command{ + rootCmd = &cobra.Command{ Use: "melt", Example: ` melt ~/.ssh/id_ed25519 melt ~/.ssh/id_ed25519 > seed @@ -57,9 +57,9 @@ var ( Short: "Generate a seed phrase from an SSH key", Long: `melt generates a seed phrase from an SSH key. That phrase can be used to rebuild your public and private keys.`, - Args: coral.ExactArgs(1), + Args: cobra.ExactArgs(1), SilenceUsage: true, - RunE: func(cmd *coral.Command, args []string) error { + RunE: func(cmd *cobra.Command, args []string) error { if err := setLanguage(language); err != nil { return err } @@ -108,14 +108,14 @@ be used to rebuild your public and private keys.`, }, } - restoreCmd = &coral.Command{ + restoreCmd = &cobra.Command{ Use: "restore", Short: "Recreate a key using the given seed phrase", Example: ` melt restore --seed "seed phrase" ./restored_id25519 melt restore ./restored_id25519 < seed`, Aliases: []string{"res", "r"}, - Args: coral.ExactArgs(1), - RunE: func(cmd *coral.Command, args []string) error { + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { if err := setLanguage(language); err != nil { return err } @@ -131,14 +131,14 @@ be used to rebuild your public and private keys.`, }, } - manCmd = &coral.Command{ + manCmd = &cobra.Command{ Use: "man", - Args: coral.NoArgs, + Args: cobra.NoArgs, Short: "generate man pages", Hidden: true, SilenceUsage: true, - RunE: func(cmd *coral.Command, args []string) error { - manPage, err := mcoral.NewManPage(1, rootCmd) + RunE: func(cmd *cobra.Command, args []string) error { + manPage, err := mcobra.NewManPage(1, rootCmd) if err != nil { // nolint: wrapcheck return err diff --git a/go.mod b/go.mod index 2bf0b9f..c090a5b 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,11 @@ require ( github.com/matryer/is v1.4.0 github.com/mattn/go-isatty v0.0.14 github.com/mattn/go-tty v0.0.4 - github.com/muesli/coral v1.0.0 - github.com/muesli/mango-coral v1.0.1 + github.com/muesli/mango-cobra v1.1.0 github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68 github.com/muesli/roff v0.1.0 github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0 + github.com/spf13/cobra v1.4.0 github.com/tyler-smith/go-bip39 v1.1.0 golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 diff --git a/go.sum b/go.sum index b22aab0..0a4bd71 100644 --- a/go.sum +++ b/go.sum @@ -20,12 +20,10 @@ github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-tty v0.0.4 h1:NVikla9X8MN0SQAqCYzpGyXv0jY7MNl3HOWD2dkle7E= github.com/mattn/go-tty v0.0.4/go.mod h1:u5GGXBtZU6RQoKV8gY5W6UhMudbR5vXnUe7j3pxse28= -github.com/muesli/coral v1.0.0 h1:odyqkoEg4aJAINOzvnjN4tUsdp+Zleccs7tRIAkkYzU= -github.com/muesli/coral v1.0.0/go.mod h1:bf91M/dkp7iHQw73HOoR9PekdTJMTD6ihJgWoDitde8= github.com/muesli/mango v0.1.0 h1:DZQK45d2gGbql1arsYA4vfg4d7I9Hfx5rX/GCmzsAvI= github.com/muesli/mango v0.1.0/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4= -github.com/muesli/mango-coral v1.0.1 h1:W3nGbUC/q5vLscQ6GPzteHZrJI1Msjw5Hns82o0xRkI= -github.com/muesli/mango-coral v1.0.1/go.mod h1:EPSlYH67AtcxQrxssNw6r/lMFxHTjuDoGfq9Uxxevhg= +github.com/muesli/mango-cobra v1.1.0 h1:j/mM5omhC2Vw8pim716aMJVElIRln089XZJ2JY7Xjzc= +github.com/muesli/mango-cobra v1.1.0/go.mod h1:lotV+49eKrAV0tTw/ONhLsiyKwM5uW5QP2OkYw4xlNc= github.com/muesli/mango-pflag v0.1.0 h1:UADqbYgpUyRoBja3g6LUL+3LErjpsOwaC9ywvBWe7Sg= github.com/muesli/mango-pflag v0.1.0/go.mod h1:YEQomTxaCUp8PrbhFh10UfbhbQrM/xJ4i2PB8VTLLW0= github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68 h1:y1p/ycavWjGT9FnmSjdbWUlLGvcxrY0Rw3ATltrxOhk= @@ -38,6 +36,8 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8=