changeset 2151:fff88c33442f

jp (info/disco): added --node argument
author Goffi <goffi@goffi.org>
date Sun, 12 Feb 2017 21:17:56 +0100 (2017-02-12)
parents 91347fe95384
children 6a004a22dd9e
files frontends/src/jp/base.py frontends/src/jp/cmd_info.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/base.py	Sun Feb 12 21:17:56 2017 +0100
+++ b/frontends/src/jp/base.py	Sun Feb 12 21:17:56 2017 +0100
@@ -286,7 +286,7 @@
         for parent_name in ('profile', 'profile_session'):
             parent = self.parents[parent_name] = argparse.ArgumentParser(add_help=False)
             parent.add_argument("-p", "--profile", action="store", type=str, default='@DEFAULT@', help=_("Use PROFILE profile key (default: %(default)s)"))
-            parent.add_argument("--pwd", action="store", type=unicode, default='', metavar='PASSWORD', help=_("Password used to connect profile, if necessary"))
+            parent.add_argument("--pwd", action="store", type=unicode_decoder, default='', metavar='PASSWORD', help=_("Password used to connect profile, if necessary"))
 
         profile_parent, profile_session_parent = self.parents['profile'], self.parents['profile_session']
 
--- a/frontends/src/jp/cmd_info.py	Sun Feb 12 21:17:56 2017 +0100
+++ b/frontends/src/jp/cmd_info.py	Sun Feb 12 21:17:56 2017 +0100
@@ -31,19 +31,20 @@
         self.need_loop=True
 
     def add_parser_options(self):
-        self.parser.add_argument("jid", type=str, help=_("entity to discover"))
+        self.parser.add_argument(u"jid", type=base.unicode_decoder, help=_(u"entity to discover"))
+        self.parser.add_argument(u"-n", u"--node", type=base.unicode_decoder, default=u'', help=_(u"node to use"))
 
     def start(self):
         jids = self.host.check_jids([self.args.jid])
         jid = jids[0]
-        self.host.bridge.discoInfos(jid, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error)
+        self.host.bridge.discoInfos(jid, node=self.args.node, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error)
 
     def error(self, failure):
         print (_("Error while doing discovery [%s]") % failure)
         self.host.quit(1)
 
     def gotInfos(self, infos, jid):
-        self.host.bridge.discoItems(jid, profile_key=self.host.profile, callback=lambda items: self.gotItems(infos, items), errback=self.error)
+        self.host.bridge.discoItems(jid, node=self.args.node, profile_key=self.host.profile, callback=lambda items: self.gotItems(infos, items), errback=self.error)
 
     def gotItems(self, infos, items):
         features, identities, extensions = infos