summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli/user.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-12-22 12:00:15 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-12-26 14:55:34 +0100
commitadbfb65946b1225b6412858fa98c28223bb9bd0f (patch)
tree6e649557a411b2e6b9514be2843ae09d86819c06 /src/leap/bitmask/cli/user.py
parent1a664736fece03a36cc3926fd6f114c811c394ab (diff)
[feat] allow to use a password for tests
the password option shouldn't appear in the help message though, to discourage users to use it as if it was a regular cli feature.
Diffstat (limited to 'src/leap/bitmask/cli/user.py')
-rw-r--r--src/leap/bitmask/cli/user.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/leap/bitmask/cli/user.py b/src/leap/bitmask/cli/user.py
index d45d503..d13d417 100644
--- a/src/leap/bitmask/cli/user.py
+++ b/src/leap/bitmask/cli/user.py
@@ -52,6 +52,13 @@ SUBCOMMANDS:
def create(self, raw_args):
args = tuple([command.appname] + sys.argv[1:4])
+ passwd = None
+
+ for (index, item) in enumerate(raw_args):
+ if item.startswith('--pass'):
+ passwd = raw_args.pop(index + 1)
+ raw_args.pop(index)
+
parser = argparse.ArgumentParser(
description='Bitmask user',
prog='%s %s %s %s' % args)
@@ -69,7 +76,8 @@ SUBCOMMANDS:
args.pop(index)
username = self.username(args)
- passwd = self._getpass_twice()
+ if not passwd:
+ passwd = self._getpass_twice()
self.data += ['create', username, passwd,
subargs.invite, 'true']
return self._send(printer=command.default_dict_printer)
@@ -129,6 +137,7 @@ SUBCOMMANDS:
color = Fore.GREEN
print(color + u['userid'] + Fore.RESET)
+
_username_kw = {
'nargs': '?',
'help': 'username ID, in the form <user@example.org>'}