Stubs out pm key create subcommand

This commit is contained in:
Stephen McQuay 2018-02-25 01:18:41 -08:00
parent 20d0b556ea
commit 5495f69b5a
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5

View File

@ -11,20 +11,37 @@ subcommands:
keyring (key) -- interact with pm's OpenPGP keyring
`
const keyUsage = `pm keyring: interact with pm's OpenPGP keyring
subcommands:
create (c) -- create a fresh keypair
`
func main() {
if len(os.Args) < 2 {
fatal(usage)
fatalf("pm: missing subcommand\n\n%v", usage)
}
cmd := os.Args[1]
switch cmd {
case "key", "keyring":
if len(os.Args[1:]) < 2 {
fatalf("pm keyring: insufficient args\n\nusage: %v", keyUsage)
}
sub := os.Args[2]
switch sub {
case "c", "create":
fmt.Printf("creating keyring ...\n")
fatalf("NYI\n")
default:
fatalf("unknown keyring subcommand: %q\n\nusage: %v", sub, keyUsage)
}
default:
fatal("uknown subcommand %q\n\nusage: %v", cmd, usage)
fatalf("uknown subcommand %q\n\nusage: %v", cmd, usage)
}
}
func fatal(f string, args ...interface{}) {
func fatalf(f string, args ...interface{}) {
fmt.Fprintf(os.Stderr, f, args...)
os.Exit(1)
}