From a7316f2e245bd31cf0c4a383d20254cffee40661 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 25 Aug 2015 09:41:45 -0700 Subject: [PATCH] Handle people specifying PGP key files with @ in front --- command/init.go | 3 +++ command/init_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/command/init.go b/command/init.go index 8e170b483..82f29c414 100644 --- a/command/init.go +++ b/command/init.go @@ -27,6 +27,9 @@ func (g *pgpkeys) Set(value string) error { return errors.New("pgp-keys can only be specified once") } for _, keyfile := range strings.Split(value, ",") { + if keyfile[0] == '@' { + keyfile = keyfile[1:] + } f, err := os.Open(keyfile) if err != nil { return err diff --git a/command/init_test.go b/command/init_test.go index eda3a92a5..e2afcba1f 100644 --- a/command/init_test.go +++ b/command/init_test.go @@ -169,7 +169,7 @@ func TestInit_PGP(t *testing.T) { args := []string{ "-address", addr, "-key-shares", "2", - "-pgp-keys", tempDir + "/pubkey1," + tempDir + "/pubkey2," + tempDir + "/pubkey3", + "-pgp-keys", tempDir + "/pubkey1,@" + tempDir + "/pubkey2," + tempDir + "/pubkey3", "-key-threshold", "2", }