Stubs out pm key create subcommand
This commit is contained in:
parent
20d0b556ea
commit
5495f69b5a
@ -11,20 +11,37 @@ subcommands:
|
|||||||
keyring (key) -- interact with pm's OpenPGP keyring
|
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() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 2 {
|
||||||
fatal(usage)
|
fatalf("pm: missing subcommand\n\n%v", usage)
|
||||||
}
|
}
|
||||||
cmd := os.Args[1]
|
cmd := os.Args[1]
|
||||||
|
|
||||||
switch cmd {
|
switch cmd {
|
||||||
case "key", "keyring":
|
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:
|
default:
|
||||||
fatal("uknown subcommand %q\n\nusage: %v", cmd, usage)
|
fatalf("unknown keyring subcommand: %q\n\nusage: %v", sub, keyUsage)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
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...)
|
fmt.Fprintf(os.Stderr, f, args...)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user