jp: separate password and connection of profile in --connect and --pwd arguments

This commit is contained in:
Goffi 2015-11-02 22:02:41 +01:00
commit 810a40c51c

View file

@ -111,7 +111,8 @@ class Jp(object):
profile_parent = self.parents['profile'] = argparse.ArgumentParser(add_help=False)
profile_parent.add_argument("-p", "--profile", action="store", type=str, default='@DEFAULT@', help=_("Use PROFILE profile key (default: %(default)s)"))
profile_parent.add_argument("-c", "--connect", action="store", type=str, nargs='?', const='', default=None, metavar='PASSWORD', help=_("Connect the profile before doing anything else"))
profile_parent.add_argument("--pwd", action="store", type=unicode, default='', metavar='PASSWORD', help=_("Password used to connect profile, if necessary"))
profile_parent.add_argument("-c", "--connect", action="store_true", help=_("Connect the profile before doing anything else"))
progress_parent = self.parents['progress'] = argparse.ArgumentParser(add_help=False)
if progressbar:
@ -243,7 +244,7 @@ class Jp(object):
# a profile can be presente without connect option (e.g. on profile creation/deletion)
return
elif self.args.connect is not None: # if connection is asked, we connect the profile
self.bridge.asyncConnect(self.profile, self.args.connect, lambda dummy: callback(), cant_connect)
self.bridge.asyncConnect(self.profile, self.args.pwd, lambda dummy: callback(), cant_connect)
self._auto_loop = True
return
elif not self.bridge.isConnected(self.profile):