Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AutoClip handling on generate #2024

Merged
merged 1 commit into from Nov 9, 2021

Conversation

dominikschulz
Copy link
Member

Fixes #2023

RELEASE_NOTES=[BUGFIX] Fix AutoClip handling on generate

Signed-off-by: Dominik Schulz dominik.schulz@gauner.org

Fixes gopasspw#2023

RELEASE_NOTES=[BUGFIX] Fix AutoClip handling on generate

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
@dominikschulz dominikschulz added the bug Defects label Nov 8, 2021
@dominikschulz dominikschulz added this to the 1.13.0 milestone Nov 8, 2021
Copy link
Member

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -120,7 +120,7 @@ func (s *Action) generateCopyOrPrint(ctx context.Context, c *cli.Context, name,
// copy to clipboard if:
// - explicitly requested with -c
// - autoclip=true, but only if output is not being redirected
if IsClip(ctx) || (s.cfg.AutoClip && !ctxutil.IsTerminal(ctx)) {
if IsClip(ctx) || (s.cfg.AutoClip && ctxutil.IsTerminal(ctx)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should be replacing the content of my new function out.IsOutputRedirected by this then.
I'm not sure how ctxutil.IsTerminal(ctx) behaves when we are piping stuff but in a terminal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now in #2025

act.cfg.AutoClip = true
ctx := ctxutil.WithTerminal(ctx, false)
assert.NoError(t, act.Generate(gptest.CliCtxWithFlags(ctx, t, map[string]string{"force": "true"}, "foobar", "24")))
assert.Contains(t, buf.String(), "Not printing secrets by default")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we printing this on StdOut? If so we might want to consider doing that on StdErr instead in a future PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this goes to stdout right now.

@dominikschulz dominikschulz merged commit 80dca45 into gopasspw:master Nov 9, 2021
@dominikschulz dominikschulz deleted the fix/issue-2023 branch November 9, 2021 05:40
kpitt pushed a commit to kpitt/gopass that referenced this pull request Jul 21, 2022
Fixes gopasspw#2023

RELEASE_NOTES=[BUGFIX] Fix AutoClip handling on generate

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autoclip on generate broken
2 participants