Skip to content

Commit c6c136e

Browse files
author
Oleiade
committed
Merge branch 'hotfix/fix_set_from_file'
2 parents 260ed84 + a562a98 commit c6c136e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

trousseau/actions.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,25 @@ func GetAction(c *cli.Context) {
296296
log.Fatal(err)
297297
}
298298

299-
fmt.Printf("%s\n", value)
299+
fmt.Printf("%s", value)
300300
}
301301

302302
func SetAction(c *cli.Context) {
303303
var key string
304-
var value interface{}
304+
var value string
305305
var err error
306306

307307
// If the --file flag is provided
308308
if c.String("file") != "" && hasExpectedArgs(c.Args(), 1) {
309309
// And the file actually exists on file system
310310
if pathExists(c.String("file")) {
311311
// Then load it's content
312-
value, err = ioutil.ReadFile(c.String("file"))
312+
fileContent, err := ioutil.ReadFile(c.String("file"))
313313
if err != nil {
314314
log.Fatal(err)
315315
}
316+
317+
value = string(fileContent)
316318
} else {
317319
log.Fatalf("Cannot open %s because it doesn't exist", c.String("file"))
318320
}
@@ -344,7 +346,7 @@ func SetAction(c *cli.Context) {
344346
log.Fatal(err)
345347
}
346348

347-
fmt.Printf("%s:%s\n", key, value)
349+
fmt.Printf("%s:%s", key, value)
348350
}
349351

350352
func DelAction(c *cli.Context) {
@@ -372,7 +374,7 @@ func DelAction(c *cli.Context) {
372374
log.Fatal(err)
373375
}
374376

375-
fmt.Printf("deleted: %s\n", c.Args()[0])
377+
fmt.Printf("deleted: %s", c.Args()[0])
376378
}
377379

378380
func KeysAction(c *cli.Context) {

0 commit comments

Comments
 (0)