From 37601be04f34a9b15e2b36c0a6d81e423d163f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Tue, 19 Mar 2024 10:49:02 -0700 Subject: [PATCH] use cli flag action like it should be --- cmd/agedit/cli.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/agedit/cli.go b/cmd/agedit/cli.go index 2b168dd..8407f08 100644 --- a/cmd/agedit/cli.go +++ b/cmd/agedit/cli.go @@ -49,8 +49,8 @@ var ( Name: "identity", Usage: "age identity file to use", Aliases: []string{"i"}, - Action: func(ctx *cli.Context, s string) error { - if identity_file := ctx.String("identity"); identity_file != "" { + Action: func(ctx *cli.Context, identity_file string) error { + if identity_file != "" { cfg.IdentityFile = identity_file } return nil @@ -60,8 +60,8 @@ var ( Name: "out", Usage: "write to this file instead of the input file", Aliases: []string{"o"}, - Action: func(ctx *cli.Context, s string) error { - output_file = ctx.String("out") + Action: func(ctx *cli.Context, out string) error { + output_file = out return nil }, }, @@ -71,7 +71,7 @@ var ( Value: "warn", Aliases: []string{"l"}, Action: func(ctx *cli.Context, s string) error { - if lvl, err := log.ParseLevel(ctx.String("log")); err == nil { + if lvl, err := log.ParseLevel(s); err == nil { logger.SetLevel(lvl) // Some extra info for debug level if logger.GetLevel() == log.DebugLevel { @@ -87,8 +87,8 @@ var ( Name: "editor", Usage: "specify the editor to use", Aliases: []string{"e"}, - Action: func(ctx *cli.Context, s string) error { - cfg.Editor = ctx.String("editor") + Action: func(ctx *cli.Context, editor string) error { + cfg.Editor = editor return nil }, },