diff --git a/connect.go b/connect.go index ef93e8e..959f1bd 100644 --- a/connect.go +++ b/connect.go @@ -35,6 +35,7 @@ type Connection struct { AskPath bool Debug bool DontEncrypt bool + Yes bool UseStdout bool Wait bool bar *progressbar.ProgressBar @@ -65,6 +66,7 @@ func NewConnection(config *AppConfig) (*Connection, error) { c.Code = config.Code c.NumberOfConnections = config.NumberOfConnections c.UseStdout = config.UseStdout + c.Yes = config.Yes c.rate = config.Rate if len(config.File) > 0 { if config.File == "stdin" { @@ -408,7 +410,10 @@ func (c *Connection) runClient() error { fmt.Fprintf(os.Stderr, "Will not overwrite file!") os.Exit(1) } - getOK := getInput("ok? (y/n): ") + getOK := "y" + if !c.Yes { + getOK = getInput("ok? (y/n): ") + } if getOK == "y" { responses.Lock() responses.gotOK = true diff --git a/main.go b/main.go index 2ecbd5b..8e46dfd 100644 --- a/main.go +++ b/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"` 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"` + 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"` 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:""`