croc: secret phrase parsing

what:
- `croc alpha beta gamma` is now properly understood as
 `croc alpha-beta-gamma`.

why:
- to increase convenience.
This commit is contained in:
Roman 2020-02-17 21:26:13 -07:00
parent 29882db39b
commit df79b2ed8e
1 changed files with 8 additions and 1 deletions

View File

@ -304,8 +304,15 @@ func receive(c *cli.Context) (err error) {
Ask: c.GlobalBool("ask"),
RelayPassword: c.GlobalString("pass"),
}
if c.Args().First() != "" {
switch len(c.Args()) {
case 1:
crocOptions.SharedSecret = c.Args().First()
case 3:
var phrase []string
phrase = append(phrase, c.Args().First())
phrase = append(phrase, c.Args().Tail()...)
crocOptions.SharedSecret = strings.Join(phrase, "-")
}
// load options here