Skip to content

Commit cb4ba72

Browse files
authored
[ENHANCEMENT] Make it possible to override show.autoclip (#3082)
* [ENHANCEMENT] Make it possible to override `show.autoclip` With this change is now possible to use `--alsoclip=false` on the command line to override the `show.autoclip` set in the config file. Signed-off-by: Fabio Alessandro Locati <[email protected]> * Improve code legibility Signed-off-by: Fabio Alessandro Locati <[email protected]> * Improve logic Signed-off-by: Fabio Alessandro Locati <[email protected]> --------- Signed-off-by: Fabio Alessandro Locati <[email protected]>
1 parent 21687ee commit cb4ba72

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/action/show.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func showParseArgs(c *cli.Context) context.Context {
4949
ctx = WithRevision(ctx, c.String("revision"))
5050
}
5151

52+
ctx = WithAlsoClip(ctx, config.Bool(ctx, "show.autoclip"))
5253
if c.IsSet("alsoclip") {
5354
ctx = WithAlsoClip(ctx, c.Bool("alsoclip"))
5455
}
@@ -214,7 +215,7 @@ func (s *Action) showHandleOutput(ctx context.Context, name string, sec gopass.S
214215
}
215216
}
216217

217-
if (IsClip(ctx) || config.Bool(ctx, "show.autoclip")) && pw != "" {
218+
if (IsClip(ctx) || IsAlsoClip(ctx)) && pw != "" {
218219
if err := clipboard.CopyTo(ctx, name, []byte(pw), config.AsInt(s.cfg.Get("core.cliptimeout"))); err != nil {
219220
return err
220221
}
@@ -274,7 +275,7 @@ func (s *Action) showGetContent(ctx context.Context, sec gopass.Secret) (string,
274275
// everything but the first line.
275276
if config.Bool(ctx, "show.safecontent") && !ctxutil.IsForce(ctx) && ctxutil.IsShowParsing(ctx) {
276277
body := showSafeContent(sec)
277-
if IsAlsoClip(ctx) || config.Bool(ctx, "show.autoclip") {
278+
if IsAlsoClip(ctx) {
278279
return pw, body, nil
279280
}
280281

0 commit comments

Comments
 (0)