mirror of https://github.com/schollz/croc.git
Allow auto-receive
This commit is contained in:
parent
39e2a20a6f
commit
68b937f4cb
|
@ -35,6 +35,7 @@ type Connection struct {
|
||||||
AskPath bool
|
AskPath bool
|
||||||
Debug bool
|
Debug bool
|
||||||
DontEncrypt bool
|
DontEncrypt bool
|
||||||
|
Yes bool
|
||||||
UseStdout bool
|
UseStdout bool
|
||||||
Wait bool
|
Wait bool
|
||||||
bar *progressbar.ProgressBar
|
bar *progressbar.ProgressBar
|
||||||
|
@ -65,6 +66,7 @@ func NewConnection(config *AppConfig) (*Connection, error) {
|
||||||
c.Code = config.Code
|
c.Code = config.Code
|
||||||
c.NumberOfConnections = config.NumberOfConnections
|
c.NumberOfConnections = config.NumberOfConnections
|
||||||
c.UseStdout = config.UseStdout
|
c.UseStdout = config.UseStdout
|
||||||
|
c.Yes = config.Yes
|
||||||
c.rate = config.Rate
|
c.rate = config.Rate
|
||||||
if len(config.File) > 0 {
|
if len(config.File) > 0 {
|
||||||
if config.File == "stdin" {
|
if config.File == "stdin" {
|
||||||
|
@ -408,7 +410,10 @@ func (c *Connection) runClient() error {
|
||||||
fmt.Fprintf(os.Stderr, "Will not overwrite file!")
|
fmt.Fprintf(os.Stderr, "Will not overwrite file!")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
getOK := getInput("ok? (y/n): ")
|
getOK := "y"
|
||||||
|
if !c.Yes {
|
||||||
|
getOK = getInput("ok? (y/n): ")
|
||||||
|
}
|
||||||
if getOK == "y" {
|
if getOK == "y" {
|
||||||
responses.Lock()
|
responses.Lock()
|
||||||
responses.gotOK = true
|
responses.gotOK = true
|
||||||
|
|
1
main.go
1
main.go
|
@ -20,6 +20,7 @@ type AppConfig struct {
|
||||||
PathSpec bool `yaml:"ask-save" flagName:"ask-save" flagSName:"q" flagDescribe:"Ask for path to save to" default:"false"`
|
PathSpec bool `yaml:"ask-save" flagName:"ask-save" flagSName:"q" flagDescribe:"Ask for path to save to" default:"false"`
|
||||||
DontEncrypt bool `yaml:"no-encrypt" flagName:"no-encrypt" flagSName:"g" flagDescribe:"Turn off encryption" default:"false"`
|
DontEncrypt bool `yaml:"no-encrypt" flagName:"no-encrypt" flagSName:"g" flagDescribe:"Turn off encryption" default:"false"`
|
||||||
UseStdout bool `yaml:"stdout" flagName:"stdout" flagSName:"o" flagDescribe:"Use stdout" default:"false"`
|
UseStdout bool `yaml:"stdout" flagName:"stdout" flagSName:"o" flagDescribe:"Use stdout" default:"false"`
|
||||||
|
Yes bool `yaml:"yes" flagName:"yes" flagSName:"y" flagDescribe:"Automatically accept file" default:"false"`
|
||||||
Server string `yaml:"server" flagName:"server" flagSName:"l" flagDescribe:"Address of relay server" default:"cowyo.com"`
|
Server string `yaml:"server" flagName:"server" flagSName:"l" flagDescribe:"Address of relay server" default:"cowyo.com"`
|
||||||
File string `yaml:"send" flagName:"send" flagSName:"s" flagDescribe:"File to send (\"stdin\" to read from stdin)" default:""`
|
File string `yaml:"send" flagName:"send" flagSName:"s" flagDescribe:"File to send (\"stdin\" to read from stdin)" default:""`
|
||||||
Path string `yaml:"save" flagName:"save" flagSName:"p" flagDescribe:"Path to save to" default:""`
|
Path string `yaml:"save" flagName:"save" flagSName:"p" flagDescribe:"Path to save to" default:""`
|
||||||
|
|
Loading…
Reference in New Issue