diff frontends/src/jp/cmd_profile.py @ 1597:91a605feed8c

jp: added profile/connect command
author Goffi <goffi@goffi.org>
date Sat, 14 Nov 2015 19:19:04 +0100
parents b7ee113183fc
children de9cc4d62a4a
line wrap: on
line diff
--- a/frontends/src/jp/cmd_profile.py	Sat Nov 14 19:18:10 2015 +0100
+++ b/frontends/src/jp/cmd_profile.py	Sat Nov 14 19:19:04 2015 +0100
@@ -29,6 +29,18 @@
 PROFILE_HELP = _('The name of the profile')
 
 
+class ProfileConnect(base.CommandBase):
+    """Dummy command to use profile_session parent, i.e. to be able to connect without doing anything else"""
+
+    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
+        super(ProfileConnect, self).__init__(host, 'connect', need_connect=False, help=_('connect a profile'))
+
+    def add_parser_options(self):
+        pass
+
+
 class ProfileDefault(base.CommandBase):
     def __init__(self, host):
         super(ProfileDefault, self).__init__(host, 'default', use_profile=False, help=_('print default profile'))
@@ -100,7 +112,7 @@
 
 class ProfileCreate(base.CommandBase):
     def __init__(self, host):
-        super(ProfileCreate, self).__init__(host, 'create', use_profile=False, help=_('Create a new profile'))
+        super(ProfileCreate, self).__init__(host, 'create', use_profile=False, help=_('create a new profile'))
 
     def add_parser_options(self):
         self.parser.add_argument('profile', type=str, help=_('the name of the profile'))
@@ -128,7 +140,7 @@
 
 class ProfileModify(base.CommandBase):
     def __init__(self, host):
-        super(ProfileModify, self).__init__(host, 'modify', need_connect=False, help=_('Modify an existing profile'))
+        super(ProfileModify, self).__init__(host, 'modify', need_connect=False, help=_('modify an existing profile'))
 
     def add_parser_options(self):
         self.parser.add_argument('-w', '--password', type=str, default='', help=_('the password of the profile'))
@@ -158,7 +170,7 @@
 
 
 class Profile(base.CommandBase):
-    subcommands = (ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify)
+    subcommands = (ProfileConnect, ProfileCreate, ProfileDefault, ProfileDelete, ProfileInfo, ProfileList, ProfileModify)
 
     def __init__(self, host):
         super(Profile, self).__init__(host, 'profile', use_profile=False, help=_('Profile commands'))