mirror of https://github.com/schollz/croc.git
add back prompt for code
This commit is contained in:
parent
e7d2f05399
commit
d4fa4bc9c0
|
@ -22,11 +22,11 @@ _These two gifs should run in sync if you force-reload (Ctl+F5)_
|
|||
|
||||
**Sender:**
|
||||
|
||||
![send](https://user-images.githubusercontent.com/6550035/32415611-9bfa858a-c1f9-11e7-9573-52c1edc52e5f.gif)
|
||||
![send](https://raw.githubusercontent.com/schollz/croc/master/logo/sender.gif)
|
||||
|
||||
**Receiver:**
|
||||
|
||||
![receive](https://user-images.githubusercontent.com/6550035/32415609-9ba49dc8-c1f9-11e7-9c86-ea0baae730fe.gif)
|
||||
![receive](https://raw.githubusercontent.com/schollz/croc/master/logo/receiver.gif)
|
||||
|
||||
|
||||
**Sender:**
|
||||
|
|
18
connect.go
18
connect.go
|
@ -108,7 +108,7 @@ func NewConnection(config *AppConfig) (*Connection, error) {
|
|||
}
|
||||
|
||||
if info.Mode().IsDir() { // if our file is a dir
|
||||
fmt.Println("compressing directory...")
|
||||
fmt.Println("Compressing folder...")
|
||||
|
||||
// we "tarify" the file
|
||||
err = tarinator.Tarinate([]string{config.File}, path.Base(config.File)+".tar")
|
||||
|
@ -208,7 +208,11 @@ func (c *Connection) Run() error {
|
|||
|
||||
log.Debug("checking code validity")
|
||||
if len(c.Code) == 0 {
|
||||
c.Code = GetRandomName()
|
||||
if c.IsSender {
|
||||
c.Code = GetRandomName()
|
||||
} else {
|
||||
c.Code = getInput("Enter receive code: ")
|
||||
}
|
||||
log.Debug("changed code to ", c.Code)
|
||||
}
|
||||
|
||||
|
@ -507,10 +511,14 @@ func (c *Connection) runClient() error {
|
|||
fmt.Println("Timeout waiting for receiver")
|
||||
return nil
|
||||
}
|
||||
fmt.Print("\nFile sent")
|
||||
fileOrFolder := "File"
|
||||
if c.File.IsDir {
|
||||
fileOrFolder = "Folder"
|
||||
}
|
||||
fmt.Printf("\n%s sent", fileOrFolder)
|
||||
} else { // Is a Receiver
|
||||
if responses.notPresent {
|
||||
fmt.Println("Sender is not ready. Use -wait to wait until sender connects.")
|
||||
fmt.Println("Either code is incorrect or sender is not ready. Use -wait to wait until sender connects.")
|
||||
return nil
|
||||
}
|
||||
if !responses.gotOK {
|
||||
|
@ -550,7 +558,7 @@ func (c *Connection) runClient() error {
|
|||
return fmt.Errorf("\nUh oh! %s is corrupted! Sorry, try again.\n", c.File.Name)
|
||||
}
|
||||
if c.File.IsDir { // if the file was originally a dir
|
||||
fmt.Print("\ndecompressing folder")
|
||||
fmt.Print("\nDecompressing folder...")
|
||||
log.Debug("untarring " + c.File.Name)
|
||||
err := tarinator.UnTarinate(c.Path, path.Join(c.Path, c.File.Name))
|
||||
if err != nil {
|
||||
|
|
13
help.go
13
help.go
|
@ -1,6 +1,17 @@
|
|||
package main
|
||||
|
||||
var helpTemplate = `NAME:
|
||||
var helpTemplate = `
|
||||
,_
|
||||
>' )
|
||||
( ( \
|
||||
|| \
|
||||
/^^^^\ ||
|
||||
/^^\________/0 \ ||
|
||||
( ` + "`" + `~+++,,_||__,,++~^^^^^^^
|
||||
...V^V^V^V^V^V^\...............................
|
||||
|
||||
|
||||
NAME:
|
||||
{{.Name}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
17
main.go
17
main.go
|
@ -13,7 +13,6 @@ import (
|
|||
const BUFFERSIZE = 1024
|
||||
|
||||
type AppConfig struct {
|
||||
HideLogo bool `yaml:"hidelogo" flagName:"hidelogo" flagSName:"hl" flagDescribe:"Hidden logo" default:"false"`
|
||||
Relay bool `yaml:"relay" flagName:"relay" flagSName:"r" flagDescribe:"Run as relay" default:"false"`
|
||||
Debug bool `yaml:"debug" flagName:"debug" flagSName:"d" flagDescribe:"Debug mode" default:"false"`
|
||||
Wait bool `yaml:"wait" flagName:"wait" flagSName:"w" flagDescribe:"Wait for code to be sent" default:"false"`
|
||||
|
@ -77,22 +76,6 @@ func main() {
|
|||
}
|
||||
|
||||
ApplyFlags(cliFlags, flagMappings, c, appOptions)
|
||||
if appOptions.UseStdout {
|
||||
appOptions.HideLogo = true
|
||||
}
|
||||
if !appOptions.HideLogo {
|
||||
fmt.Println(`
|
||||
,_
|
||||
>' )
|
||||
croc version ` + fmt.Sprintf("%5s", version) + ` ( ( \
|
||||
|| \
|
||||
/^^^^\ ||
|
||||
/^^\________/0 \ ||
|
||||
( ` + "`" + `~+++,,_||__,,++~^^^^^^^
|
||||
...V^V^V^V^V^V^\...............................
|
||||
|
||||
`)
|
||||
}
|
||||
|
||||
if appOptions.Relay {
|
||||
fmt.Println("running relay on local address " + GetLocalIP())
|
||||
|
|
Loading…
Reference in New Issue