Allow to set password from pipe
The usecase is to dump the output of a command into the keyring. For
example a random token is generated and must be stored.
@@ -89,8 +89,10 @@ class CommandLineTool(object):
This mostly exists to ease the testing process.
"""
-
+ if sys.stdin.isatty():
return getpass.getpass(prompt)
+ else:
+ return sys.stdin.readline().rstrip()
def output_password(self, password):
"""Output the password to the user.
