Skip to content

Commit c4f321a

Browse files
committed
'vipaccess uri' should print ONLY the URI to stdout
Print the surrounding bits to stderr. This way, a command like `qrencode -t utf8 "$(vipaccess uri)"` will work. Fixes #55.
1 parent acf264e commit c4f321a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vipaccess/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def uri(p, args):
144144
key = oath.google_authenticator.lenient_b32decode(secret)
145145
except Exception as e:
146146
p.error('error interpreting secret as base32: %s' % e)
147-
print('Token URI:\n')
148-
print(' ' + vp.generate_otp_uri(d, key, args.issuer))
147+
if args.verbose:
148+
print('Token URI:\n ', file=sys.stderr, end='')
149+
print(vp.generate_otp_uri(d, key, args.issuer))
149150

150151
def show(p, args):
151152
if args.secret:
@@ -226,6 +227,7 @@ def __call__(self, parser, namespace, values, option_string=None):
226227
help="Specify the issuer name to use (default: Symantec)")
227228
puri.add_argument('-I', '--identity', action='store',
228229
help="Specify the ID of the token to use (required with --secret))")
230+
puri.add_argument('-v', '--verbose', action='store_true')
229231
puri.set_defaults(func=uri)
230232

231233
p.set_default_subparser('show')

0 commit comments

Comments
 (0)