recipient also uses codephrase

This commit is contained in:
Zack Scholl 2018-10-21 08:25:53 -07:00
parent dd03cdc6e3
commit 69b19c7e78
1 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,6 @@ import (
)
var Version string
var codePhrase string
var cr *croc.Croc
func Run() {
@ -199,20 +198,21 @@ func send(c *cli.Context) error {
func receive(c *cli.Context) error {
if c.GlobalString("code") != "" {
codePhrase = c.GlobalString("code")
cr.Codephrase = c.GlobalString("code")
}
if c.Args().First() != "" {
codePhrase = c.Args().First()
cr.Codephrase = c.Args().First()
}
cr.LoadConfig()
openFolder := false
if len(os.Args) == 1 {
// open folder since they didn't give any arguments
openFolder = true
}
if codePhrase == "" {
codePhrase = utils.GetInput("Enter receive code: ")
if cr.Codephrase == "" {
cr.Codephrase = utils.GetInput("Enter receive code: ")
}
err := cr.Receive(codePhrase)
err := cr.Receive(cr.Codephrase)
if err == nil && openFolder {
cwd, _ := os.Getwd()
open.Run(cwd)