Skip to content

Commit

Permalink
refactor: switch to cobra
Browse files Browse the repository at this point in the history
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 <caarlos0@gmail.com>
  • Loading branch information
caarlos0 authored and muesli committed May 6, 2022
1 parent 911eb47 commit a1a68d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions cmd/melt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down

0 comments on commit a1a68d2

Please sign in to comment.