Allow auto-receive

This commit is contained in:
Zack Scholl 2018-04-13 15:31:03 -07:00
parent 39e2a20a6f
commit 68b937f4cb
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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:""`