Skip to content

Commit

Permalink
Introduce var doRemember in cli receive function
Browse files Browse the repository at this point in the history
  • Loading branch information
a1lu committed Apr 1, 2024
1 parent 8bc7a62 commit cd89e80
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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, "", " ")
Expand Down

0 comments on commit cd89e80

Please sign in to comment.