mirror of https://github.com/schollz/croc.git
recipient also uses codephrase
This commit is contained in:
parent
dd03cdc6e3
commit
69b19c7e78
|
@ -19,7 +19,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version string
|
var Version string
|
||||||
var codePhrase string
|
|
||||||
var cr *croc.Croc
|
var cr *croc.Croc
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
|
@ -199,20 +198,21 @@ func send(c *cli.Context) error {
|
||||||
|
|
||||||
func receive(c *cli.Context) error {
|
func receive(c *cli.Context) error {
|
||||||
if c.GlobalString("code") != "" {
|
if c.GlobalString("code") != "" {
|
||||||
codePhrase = c.GlobalString("code")
|
cr.Codephrase = c.GlobalString("code")
|
||||||
}
|
}
|
||||||
if c.Args().First() != "" {
|
if c.Args().First() != "" {
|
||||||
codePhrase = c.Args().First()
|
cr.Codephrase = c.Args().First()
|
||||||
}
|
}
|
||||||
|
cr.LoadConfig()
|
||||||
openFolder := false
|
openFolder := false
|
||||||
if len(os.Args) == 1 {
|
if len(os.Args) == 1 {
|
||||||
// open folder since they didn't give any arguments
|
// open folder since they didn't give any arguments
|
||||||
openFolder = true
|
openFolder = true
|
||||||
}
|
}
|
||||||
if codePhrase == "" {
|
if cr.Codephrase == "" {
|
||||||
codePhrase = utils.GetInput("Enter receive code: ")
|
cr.Codephrase = utils.GetInput("Enter receive code: ")
|
||||||
}
|
}
|
||||||
err := cr.Receive(codePhrase)
|
err := cr.Receive(cr.Codephrase)
|
||||||
if err == nil && openFolder {
|
if err == nil && openFolder {
|
||||||
cwd, _ := os.Getwd()
|
cwd, _ := os.Getwd()
|
||||||
open.Run(cwd)
|
open.Run(cwd)
|
||||||
|
|
Loading…
Reference in New Issue