changeset 2336:a7438fe4e24d

jp (profile): added disconnect command
author Goffi <goffi@goffi.org>
date Sun, 20 Aug 2017 10:26:10 +0200
parents b226f545f67e
children 3399971f0aa0
files frontends/src/jp/cmd_profile.py
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/cmd_profile.py	Mon Jul 17 16:20:55 2017 +0200
+++ b/frontends/src/jp/cmd_profile.py	Sun Aug 20 10:26:10 2017 +0200
@@ -35,13 +35,26 @@
 
     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 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'))