1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-10 21:01:02 +02:00

update ui

This commit is contained in:
Zack Scholl 2018-07-07 06:46:40 -07:00
parent 2081b4e17e
commit 53db42fe5f
3 changed files with 79 additions and 80 deletions

21
main.go
View file

@ -35,23 +35,15 @@ func main() {
Description: "send a file over the relay",
ArgsUsage: "[filename]",
Flags: []cli.Flag{
cli.BoolFlag{Name: "no-compress, o"},
cli.BoolFlag{Name: "no-encrypt, e"},
cli.BoolFlag{Name: "no-compress, o", Usage: "disable compression"},
cli.BoolFlag{Name: "no-encrypt, e", Usage: "disable encryption"},
cli.StringFlag{Name: "code, c", Usage: "codephrase used to connect to relay"},
},
HelpName: "croc send",
Action: func(c *cli.Context) error {
return send(c)
},
},
{
Name: "receive",
Usage: "receive a file",
Description: "receve a file over the relay",
HelpName: "croc receive",
Action: func(c *cli.Context) error {
return receive(c)
},
},
{
Name: "relay",
Usage: "start a croc relay",
@ -69,7 +61,6 @@ func main() {
}
app.Flags = []cli.Flag{
cli.StringFlag{Name: "relay", Value: "wss://croc3.schollz.com"},
cli.StringFlag{Name: "code, c", Usage: "codephrase used to connect to relay"},
cli.BoolFlag{Name: "no-local", Usage: "disable local mode"},
cli.BoolFlag{Name: "local", Usage: "use only local mode"},
cli.BoolFlag{Name: "debug", Usage: "increase verbosity (a lot)"},
@ -80,7 +71,7 @@ func main() {
app.HideHelp = false
app.HideVersion = false
app.BashComplete = func(c *cli.Context) {
fmt.Fprintf(c.App.Writer, "lipstick\nkiss\nme\nlipstick\nringo\n")
fmt.Fprintf(c.App.Writer, "send\nreceive\relay")
}
app.Action = func(c *cli.Context) error {
return receive(c)
@ -116,8 +107,8 @@ func send(c *cli.Context) error {
}
cr.UseCompression = !c.Bool("no-compress")
cr.UseEncryption = !c.Bool("no-encrypt")
if c.GlobalString("code") != "" {
codePhrase = c.GlobalString("code")
if c.String("code") != "" {
codePhrase = c.String("code")
}
return cr.Send(fname, codePhrase)
}