-
Notifications
You must be signed in to change notification settings - Fork 10
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
--stdout should print a single token and exit #1
Comments
Hi @c-bandy, thanks for the feedback. Very happy this is useful to others. This is a good point. I agree that a command line utility should be composable and behave predictably. I use the mutating pasteboard heavily myself, so I'll take a look, and see how I could refactor this to accomodate both use cases. |
@Kirsis Maybe the |
Hello, we used complex passwords, where OTP is part of password. I used before:
Your tool is great, cos it used Touch ID. Will be nice to have some behariour as |
fwiw from collections import deque
import re
from subprocess import Popen, PIPE
def popen(cmd):
return Popen(cmd.split(' '), stdout=PIPE, stderr=PIPE, stdin=PIPE, bufsize=0)
def twofa(user, account):
resp = deque(maxlen=6)
with popen(f'twofa get --stdout {user}@{account}') as p:
while 1:
resp.append(p.stdout.read(1).decode())
code = ''.join(resp)
if re.match(r'[0-9]{6}', code):
return code
return None |
Exactly the tool I was looking for and so glad I didn't have to write it myself! Thanks! Just wanted to add another vote to this issue. I need to include this in other automation scripts. Doesn't matter to me what flag is used or if one is used at all, but this behavior of printing one code and exiting is an absolute necessity. |
Hi, first of all, this tool is fantastic and has made my life a lot easier - so thanks for that!
I think the
--stdout
flag would be more useful if its behavior was changed to only output a single auth token, and then exit. No bells and whistles of mutating your pasteboard. This would make automating with other tools more useful, and is also more standard since it's what the--stdout
flag usually does in a program.An example of where this is useful is with CLI tools that use MFA tokens. If you have MFA and you need to auth you can use command substitution to do this, eliminating the step of needing to paste the code.
The text was updated successfully, but these errors were encountered: