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

Add argument to not output newline with "get" #657

Closed

Conversation

wcooley
Copy link

@wcooley wcooley commented Oct 19, 2023

This PR addresses #656 which I opened earlier today. It doesn't do anything with completion support; I have to confess that I do not know how that works.

While this could be more sophisticated (such as supporting a --newline for symmetry, to undo the effect of a prior --no-newline), this is enough to get started and for my own personal needs.

While this could be more sophisticated (such as supporting a `--newline`
for symmetry, to undo the effect of a prior `--no-newline`), this is
enough to get started and for my own personal needs.
@jaraco
Copy link
Owner

jaraco commented Nov 12, 2023

Thanks for the contrib. I have some reservations, but nothing that can't be overcome.

My reservations stem from, "why hasn't this issue been solved elsewhere?" In other words, it seems to me that keyring isn't the first application to output text in a CLI for use in a pipe. Is there an established convention for handling these sorts of situations? Is there an existing library that implements these conventions (such that they don't have to be implemented inline with keyring's unique logic)? I suspect the answer is "no, every application just does its own thing and it's the responsibility of each application to adapt to its users' needs as the arise," but I'd be delighted if there were some guidance out there.

My other reservation is with the use of a boolean parameter. I try to avoid the use of those. I'd prefer something like "--format" or "--template", which specifies the format of the output, and maybe default to "{password}\n" but allow it to be overridden by "--format {password}". I'm less sure about this concern, and it depends a lot on what background we might discover in the first concern.

Let me know what you find / think.

@jaraco
Copy link
Owner

jaraco commented Feb 27, 2024

Another consideration - maybe keyring should detect if the output is being piped, and in that case, default to a format without the newline.

@jaraco
Copy link
Owner

jaraco commented Mar 5, 2024

What do you think about re-using the is tty logic to infer whether the caller would prefer a newline?

@jaraco
Copy link
Owner

jaraco commented Jun 5, 2024

Since this issue is languishing, I'm going to close it for now. Feel free to revive the conversation and we can re-open it.

@jaraco jaraco closed this Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants