# HG changeset patch # User Sadrul Habib Chowdhury # Date 1171836044 0 # Node ID 898fe63dd00842a601d7f0ca8241528acae5e1bd # Parent 836d7c247d229c58d68ee2daec65b02ae17625ae Fix bug #1662186: "gaim-remote --help doesn't work" by showing the help for any invalid command. diff -r 836d7c247d22 -r 898fe63dd008 libpurple/gaim-remote --- a/libpurple/gaim-remote Sun Feb 18 04:49:56 2007 +0000 +++ b/libpurple/gaim-remote Sun Feb 18 22:00:44 2007 +0000 @@ -30,6 +30,38 @@ raise "Error: " + self.attr + " " + str(args) + " returned " + str(result) return result +def show_help(): + print """This program uses DBus to communicate with gaim. + +Usage: + + %s "command1" "command2" ... + +Each command is of one of the three types: + + [protocol:]commandname?param1=value1¶m2=value2&... + FunctionName?param1=value1¶m2=value2&... + FunctionName(value1,value2,...) + +The second and third form are provided for completeness but their use +is not recommended; use gaim-send or gaim-send-async instead. The +second form uses introspection to find out the parameter names and +their types, therefore it is rather slow. + +Examples of commands: + + jabber:goim?screenname=testone@localhost&message=hi + jabber:gochat?room=TestRoom&server=conference.localhost + jabber:getinfo?screenname=testone@localhost + jabber:addbuddy?screenname=my friend + + setstatus?status=away&message=don't disturb + quit + + GaimAccountsFindConnected?name=&protocol=prpl-jabber + GaimAccountFindConnected(,prpl-jabber) +""" % sys.argv[0] + cgaim = CheckedObject(gaim) urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" @@ -169,40 +201,11 @@ else: raise "Don't know how to handle type \"%s\"" % type return gaim.__getattr__(command)(*methodparams) + show_help() raise "Unknown command: %s" % command - if len(sys.argv) == 1: - print """This program uses DBus to communicate with gaim. - -Usage: - - %s "command1" "command2" ... - -Each command is of one of the three types: - - [protocol:]commandname?param1=value1¶m2=value2&... - FunctionName?param1=value1¶m2=value2&... - FunctionName(value1,value2,...) - -The second and third form are provided for completeness but their use -is not recommended; use gaim-send or gaim-send-async instead. The -second form uses introspection to find out the parameter names and -their types, therefore it is rather slow. - -Examples of commands: - - jabber:goim?screenname=testone@localhost&message=hi - jabber:gochat?room=TestRoom&server=conference.localhost - jabber:getinfo?screenname=testone@localhost - jabber:addbuddy?screenname=my friend - - setstatus?status=away&message=don't disturb - quit - - GaimAccountsFindConnected?name=&protocol=prpl-jabber - GaimAccountFindConnected(,prpl-jabber) -""" % sys.argv[0] + show_help() for arg in sys.argv[1:]: output = execute(arg)