Files
keyfunc/internal/cli/cli.go
clawbot d69bed722a
All checks were successful
check / check (push) Successful in 4s
The mnemonic command: child mnemonics (closes #4)
keyfunc mnemonic derives a 12, 18 or 24 word child mnemonic through BIP-85's own mnemonic application, with the specification's test vectors as tests. One review round, passed with no findings; the reviewer reproduced the vectors from an implementation written from the specification alone.

Model: opus-5 (implementation and review); fable-5-1 (landing)
2026-09-07 18:05:08 +02:00

50 lines
1.1 KiB
Go

// Package cli builds the command tree and runs it.
package cli
import (
"fmt"
"os"
"git.eeqj.de/sneak/keyfunc/internal/cli/mnemonic"
"git.eeqj.de/sneak/keyfunc/internal/cli/options"
"git.eeqj.de/sneak/keyfunc/internal/cli/ssh"
"github.com/spf13/cobra"
)
// Version is what --version prints. The build sets it.
//
//nolint:gochecknoglobals // set at build time with -ldflags
var Version = "dev"
// Root returns the whole command tree.
func Root() *cobra.Command {
root := &cobra.Command{
Use: "keyfunc",
Short: "derive key pairs from a BIP-39 mnemonic",
Long: "keyfunc turns a BIP-39 mnemonic into key pairs that can " +
"be recreated from that mnemonic at any time. The same " +
"mnemonic, key type and index always give the same key.",
Version: Version,
SilenceUsage: true,
SilenceErrors: true,
}
options.Add(root)
root.AddCommand(ssh.Command(), mnemonic.Command())
return root
}
// Main runs the tool and returns the status the process should exit
// with.
func Main() int {
err := Root().Execute()
if err != nil {
fmt.Fprintln(os.Stderr, "keyfunc: "+err.Error())
return 1
}
return 0
}