mirror of
https://github.com/schollz/croc.git
synced 2025-01-05 12:35:56 +03:00
Introduce var doRemember in cli receive function
This commit is contained in:
parent
8bc7a62b9e
commit
cd89e8043f
@ -455,12 +455,13 @@ func receive(c *cli.Context) (err error) {
|
||||
// load options here
|
||||
setDebugLevel(c)
|
||||
|
||||
configFile, err := getReceiveConfigFile()
|
||||
if err != nil && c.Bool("remember") {
|
||||
doRemember := c.Bool("remember")
|
||||
configFile, err := getReceiveConfigFile(doRemember)
|
||||
if err != nil && doRemember {
|
||||
return
|
||||
}
|
||||
b, errOpen := os.ReadFile(configFile)
|
||||
if errOpen == nil && !c.Bool("remember") {
|
||||
if errOpen == nil && !doRemember {
|
||||
var rememberedOptions croc.Options
|
||||
err = json.Unmarshal(b, &rememberedOptions)
|
||||
if err != nil {
|
||||
@ -519,7 +520,7 @@ func receive(c *cli.Context) (err error) {
|
||||
}
|
||||
|
||||
// save the config
|
||||
if c.Bool("remember") {
|
||||
if doRemember {
|
||||
log.Debug("saving config file")
|
||||
var bConfig []byte
|
||||
bConfig, err = json.MarshalIndent(crocOptions, "", " ")
|
||||
|
Loading…
Reference in New Issue
Block a user