jaraco / keyring

MIT License
1.24k stars 152 forks source link

Feature request: CLI option to output password without newline? #656

Open wcooley opened 10 months ago

wcooley commented 10 months ago

I would like to request an option to output the password without the trailing newline. I have found a number of cases where the newline ends up being included as part of the password, such as the password file that the OpenLDAP clients can use (-y <file>) and when piping into pbcopy on macos (to paste into a GUI dialog box).

I would even like to go so far as to request not only a parameter for the command line but to suggest that os.isatty(sys.stdout.fileno())(or something similar) be used to exclude the newline when stdout isn't the terminal. But this would be a breaking change, so such a change might not be feasible.

(I know that I can easily strip the newline in various ways, like |tr -d '\n', but that is much less convenient.)