Allowing disabling the default prompt suffix in `Base.getpass()`
By default Base.getpass() will append : to the prompt, but sometimes that's undesirable, so now there's a with_suffix keyword argument to disable it.
For context, my use-case is showing SSH prompts received from a server verbatim to the user. I did attempt to write a test for this but it would've required a lot of refactoring since getpass() is pretty hardcoded to expect input from stdin :\ An alternative design would be to have a suffix=": " argument instead, but I couldn't think of a good usecase for a user putting the prompt suffix in a separate argument instead of message itself.
AFAICT the test failures are unrelated.
In the future, if you just click the "Commit suggestion" button then it is easier to review. Otherwise the reviewer needs to manually check that you incorporated the suggested change.
In the future, if you just click the "Commit suggestion" button then it is easier to review. Otherwise the reviewer needs to manually check that you incorporated the suggested change.
Ah sure, will do in the future :+1:
(bump)
(bump)
I don't understand the purpose of a "suffix". Is it so bad to have to write
Base.getpass("Password: ")
instead of
Base.getpass("Password")
?
Well, I can imagine it's a convenient default since a colon is a very common suffix. But removing it would be backwards incompatible so it doesn't really matter if it's useful or not.
(bump)
(bump)
I took the liberty to add a few tests here. I would be surprised if the Windows CI passes, but I figured it was worth a shot. We can disable them on Windows if it fails.
Argh, I didn't expect that changing a test file would break the build.
Thanks for putting in the effort to write tests :)
Well I was gonna complain that this didn't add tests, but then I realized that getpass didn't have any tests in the first place... and as someone who has touched that implementation I'm partly to blame for that!
I think this is now good to go!