From eebf6e50e7519a57349d8b3a7763708c7ade62bd Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 20 Aug 2017 10:26:10 +0200 Subject: [PATCH] jp (profile): added disconnect command --- frontends/src/jp/cmd_profile.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/frontends/src/jp/cmd_profile.py b/frontends/src/jp/cmd_profile.py index ec860e32..9f82cbf0 100644 --- a/frontends/src/jp/cmd_profile.py +++ b/frontends/src/jp/cmd_profile.py @@ -35,13 +35,26 @@ class ProfileConnect(base.CommandBase): def __init__(self, host): # it's weird to have a command named "connect" with need_connect=False, but it can be handy to be able - # to launch just the session, so some paradox don't hurt + # to launch just the session, so some paradoxes don't hurt super(ProfileConnect, self).__init__(host, 'connect', need_connect=False, help=(u'connect a profile')) def add_parser_options(self): pass +class ProfileDisconnect(base.CommandBase): + + def __init__(self, host): + super(ProfileDisconnect, self).__init__(host, 'disconnect', need_connect=False, help=(u'disconnect a profile')) + self.need_loop = True + + def add_parser_options(self): + pass + + def start(self): + self.host.bridge.disconnect(self.args.profile, callback=self.host.quit) + + class ProfileDefault(base.CommandBase): def __init__(self, host): super(ProfileDefault, self).__init__(host, 'default', use_profile=False, help=(u'print default profile')) @@ -184,7 +197,7 @@ class ProfileModify(base.CommandBase): class Profile(base.CommandBase): - subcommands = (ProfileConnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify) + subcommands = (ProfileConnect, ProfileDisconnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify) def __init__(self, host): super(Profile, self).__init__(host, 'profile', use_profile=False, help=_(u'profile commands'))