def main(): global STATUS_MODE global VIEW_MODE global COMMAND_MODE global COMMANDS sysArgs = sys.argv[1:] mode = STATUS_MODE settings = { "config": "tw.conf", "username": "******", "rootauthurl": "http://twitter.com/statuses/", "useragent": sys.argv[0] + " " + __version__, "statusdelimeter1": "<p class=\"entry-title entry-content\">", "statusdelimeter2": "</p>" } optlist, args = [], [] try: optlist, args = getopt.getopt(sysArgs, "u:svlc:h", [ "username="******"status", "view", "list-commands", "config=", "help" ]) except: usage() for option, value in optlist: if option == "-c" or option == "--config": settings["config"] = value try: configreader.load(open(settings["config"], "r"), settings) except IOError, e: pass
def main(): global STATUS_MODE global VIEW_MODE global COMMAND_MODE global COMMANDS sysArgs=sys.argv[1:] mode=STATUS_MODE settings={ "config":"tw.conf", "username":"******", "rootauthurl":"http://twitter.com/statuses/", "useragent":sys.argv[0]+" "+__version__, "statusdelimeter1":"<p class=\"entry-title entry-content\">", "statusdelimeter2":"</p>" } optlist, args=[], [] try: optlist, args=getopt.getopt(sysArgs, "u:svlc:h", ["username="******"status", "view", "list-commands", "config=", "help"]) except: usage() for option, value in optlist: if option=="-c" or option=="--config": settings["config"]=value try: configreader.load(open(settings["config"], "r"), settings) except IOError, e: pass
def main(): '''CLI''' system_arguments = sys.argv[1:] mode = STATUS_MODE settings = { 'config': 'tw.conf', 'username': '******', 'rootauthurl': 'http://twitter.com/statuses/', 'useragent': sys.argv[0] + ' ' + __version__, 'statusdelimeter1': '<p class=\'entry-title entry-content\'>', 'statusdelimeter2': '</p>' } optlist, args = [], [] try: optlist, args = getopt.getopt(system_arguments, 'u:svlc:h', [ 'username='******'status', 'view', 'list-commands', 'config=', 'help' ]) except getopt.GetoptError: usage() for option, value in optlist: if option == '-c' or option == '--config': settings['config'] = value try: configreader.load(open(settings['config'], 'r'), settings) except IOError: pass for option, value in optlist: if option == '-h' or option == '--help': usage() elif option == '-u' or option == '--username': settings['username'] = value elif option == '-s' or option == '--status': mode = STATUS_MODE elif option == '-v' or option == '--view': mode = VIEW_MODE elif option == '-l' or option == '--list=commands': mode = COMMAND_MODE if mode == STATUS_MODE: if len(args) < 1: usage() message = ' '.join(args) settings['password'] = getpass.getpass() set_status(settings, message) elif mode == VIEW_MODE: print(view_status(settings)) elif mode == COMMAND_MODE: print(COMMANDS)
def main(): '''CLI''' system_args = sys.argv[1:] args = [] settings = { 'config': 'tiny.conf', 'service': 'urltea', 'urltea url': 'http://urltea.com/api/text/?url=', 'tinyurl url': 'http://tinyurl.com/api-create.php?', 'description delimeter': '?', 'description': '' } try: optlist, args = getopt.getopt( system_args, 's:u:d:c:h', ['service=', 'custom-url=', 'description=', 'config=', 'help'] ) except getopt.GetoptError: usage() for option, value in optlist: if option == '-c' or option == '--config': settings['config'] = value try: configreader.load(open(settings['config'], 'r'), settings) except IOError: pass for option, value in optlist: if option == '-h' or option == '--help': usage() elif option == '-s' or option == '--service': settings['service'] = value elif option == '-d' or option == '--description': settings['description'] = value if settings['service'] != 'urltea' and len(settings['description']) > 0: usage() try: settings['posting url'] = settings[settings['service'] + ' url'] except: usage() for option, value in optlist: if option == '-u' or option == '--custom-url': settings['posting url'] = value if len(args) < 1: usage() for u in args: print(tiny(u, settings))
def main(): """CLI""" system_args = sys.argv[1:] args = [] settings = { "config": "tiny.conf", "service": "urltea", "urltea url": "http://urltea.com/api/text/?url=", "tinyurl url": "http://tinyurl.com/api-create.php?", "description delimeter": "?", "description": "" } try: optlist, args = getopt.getopt( system_args, "s:u:d:c:h", ["service=", "custom-url=", "description=", "config=", "help"] ) except getopt.GetoptError: usage() for option, value in optlist: if option == "-c" or option == "--config": settings["config"] = value try: configreader.load(open(settings["config"], "r"), settings) except IOError: pass for option, value in optlist: if option == "-h" or option == "--help": usage() elif option == "-s" or option == "--service": settings["service"] = value elif option == "-d" or option == "--description": settings["description"] = value if settings["service"] != "urltea" and len(settings["description"]) > 0: usage() try: settings["posting url"] = settings[settings["service"] + " url"] except: usage() for option, value in optlist: if option == "-u" or option == "--custom-url": settings["posting url"] = value if len(args) < 1: usage() for u in args: print tiny(u, settings)
def main(): '''CLI''' system_args = sys.argv[1:] args = [] settings = { 'config': 'tiny.conf', 'service': 'urltea', 'urltea url': 'http://urltea.com/api/text/?url=', 'tinyurl url': 'http://tinyurl.com/api-create.php?', 'description delimeter': '?', 'description': '' } try: optlist, args = getopt.getopt( system_args, 's:u:d:c:h', ['service=', 'custom-url=', 'description=', 'config=', 'help']) except getopt.GetoptError: usage() for option, value in optlist: if option == '-c' or option == '--config': settings['config'] = value try: configreader.load(open(settings['config'], 'r'), settings) except IOError: pass for option, value in optlist: if option == '-h' or option == '--help': usage() elif option == '-s' or option == '--service': settings['service'] = value elif option == '-d' or option == '--description': settings['description'] = value if settings['service'] != 'urltea' and len(settings['description']) > 0: usage() try: settings['posting url'] = settings[settings['service'] + ' url'] except: usage() for option, value in optlist: if option == '-u' or option == '--custom-url': settings['posting url'] = value if len(args) < 1: usage() for u in args: print(tiny(u, settings))
def main(): systemArgs=sys.argv[1:] args=[] settings={ "config":"tiny.conf", "service":"urltea", "urltea url":"http://urltea.com/api/text/?url=", "tinyurl url":"http://tinyurl.com/api-create.php?", "description delimeter":"?", "description":"" } try: optlist, args=getopt.getopt(systemArgs, "s:u:d:c:h", ["service=", "custom-url=", "description=", "config=", "help"]) except: usage() for option, value in optlist: if option=="-c" or option=="--config": settings["config"]=value try: configreader.load(open(settings["config"], "r"), settings) except IOError: pass for option, value in optlist: if option=="-h" or option=="--help": usage() elif option=="-s" or option=="--service": settings["service"]=value elif option=="-d" or option=="--description": settings["description"]=value if settings["service"]!="urltea" and len(settings["description"])>0: usage() try: settings["posting url"]=settings[settings["service"]+" url"] except: usage() for option, value in optlist: if option=="-u" or option=="--custom-url": settings["posting url"]=value if len(args)<1: usage() for u in args: print tiny(u, settings)
def main(): """CLI""" system_arguments = sys.argv[1:] mode = STATUS_MODE settings = { "config": "tw.conf", "username": "******", "rootauthurl": "http://twitter.com/statuses/", "useragent": sys.argv[0] + " " + __version__, "statusdelimeter1": "<p class=\"entry-title entry-content\">", "statusdelimeter2": "</p>" } optlist, args = [], [] try: optlist, args = getopt.getopt( system_arguments, "u:svlc:h", ["username="******"status", "view", "list-commands", "config=", "help"] ) except getopt.GetoptError: usage() for option, value in optlist: if option == "-c" or option == "--config": settings["config"] = value try: configreader.load(open(settings["config"], "r"), settings) except IOError: pass for option, value in optlist: if option == "-h" or option == "--help": usage() elif option == "-u" or option == "--username": settings["username"] = value elif option == "-s" or option == "--status": mode = STATUS_MODE elif option == "-v" or option == "--view": mode = VIEW_MODE elif option == "-l" or option == "--list=commands": mode = COMMAND_MODE if mode == STATUS_MODE: if len(args) < 1: usage() message = " ".join(args) settings["password"] = getpass.getpass() set_status(settings, message) elif mode == VIEW_MODE: print view_status(settings) elif mode == COMMAND_MODE: print COMMANDS
def main(): '''CLI''' system_arguments = sys.argv[1:] mode = STATUS_MODE settings = { 'config': 'tw.conf', 'username': '******', 'rootauthurl': 'http://twitter.com/statuses/', 'useragent': sys.argv[0] + ' ' + __version__, 'statusdelimeter1': '<p class=\'entry-title entry-content\'>', 'statusdelimeter2': '</p>' } optlist, args = [], [] try: optlist, args = getopt.getopt( system_arguments, 'u:svlc:h', ['username='******'status', 'view', 'list-commands', 'config=', 'help'] ) except getopt.GetoptError: usage() for option, value in optlist: if option == '-c' or option == '--config': settings['config'] = value try: configreader.load(open(settings['config'], 'r'), settings) except IOError: pass for option, value in optlist: if option == '-h' or option == '--help': usage() elif option == '-u' or option == '--username': settings['username'] = value elif option == '-s' or option == '--status': mode = STATUS_MODE elif option == '-v' or option == '--view': mode = VIEW_MODE elif option == '-l' or option == '--list=commands': mode = COMMAND_MODE if mode == STATUS_MODE: if len(args) < 1: usage() message = ' '.join(args) settings['password'] = getpass.getpass() set_status(settings, message) elif mode == VIEW_MODE: print(view_status(settings)) elif mode == COMMAND_MODE: print(COMMANDS)
def main(): """Jaiku CLI""" system_args = sys.argv[1:] mode = STATUS_MODE settings = { "config": "jaiku.conf", "xmlrpcurl": "http: //api.jaiku.com/xmlrpc", "feedurlstart": "http: //", "feedurlend": ".jaiku.com/feed/atom", "itemdelimeter": "<entry>", "titledelimeter1": "<title>", "titledelimeter2": "</title>", "username": "******", "personalkey": "", "location": "" } optlist, args = [], [] try: optlist, args = getopt.getopt( system_args, "u:p:l:svc:h", [ "username="******"personal-key=", "location=", "status", "view", "config=", "help" ] ) except getopt.GetoptError: usage() for option, value in optlist: if option == "-c" or option == "--config": settings["config"] = value try: configreader.load(open(settings["config"], "r"), settings) except IOError: pass for option, value in optlist: if option == "-h" or option == "--help": usage() elif option == "-u" or option == "--username": settings["username"] = value elif option == "-p" or option == "--personal-key": settings["personalkey"] = value elif option == "-l" or option == "--location": settings["location"] = value elif option == "-s" or option == "--status": mode = STATUS_MODE elif option == "-v" or option == "--view": mode = VIEW_MODE if mode == STATUS_MODE: if len(args) < 1: usage() message = " ".join(args) set_status(settings, message) elif mode == VIEW_MODE: print view_status(settings)
def main(): global STATUS_MODE global VIEW_MODE systemArgs = sys.argv[1:] mode = STATUS_MODE settings = { "config": "jaiku.conf", "xmlrpcurl": "http://api.jaiku.com/xmlrpc", "feedurlstart": "http://", "feedurlend": ".jaiku.com/feed/atom", "itemdelimeter": "<entry>", "titledelimeter1": "<title>", "titledelimeter2": "</title>", "username": "******", "personalkey": "", "location": "" } optlist, args = [], [] try: optlist, args = getopt.getopt(systemArgs, "u:p:l:svc:h", [ "username="******"personal-key=", "location=", "status", "view", "config=", "help" ]) except: usage() for option, value in optlist: if option == "-c" or option == "--config": settings["config"] = value try: configreader.load(open(settings["config"], "r"), settings) except IOError: pass for option, value in optlist: if option == "-h" or option == "--help": usage() elif option == "-u" or option == "--username": settings["username"] = value elif option == "-p" or option == "--personal-key": settings["personalkey"] = value elif option == "-l" or option == "--location": settings["location"] = value elif option == "-s" or option == "--status": mode = STATUS_MODE elif option == "-v" or option == "--view": mode = VIEW_MODE if mode == STATUS_MODE: if len(args) < 1: usage() message = " ".join(args) set_status(settings, message) elif mode == VIEW_MODE: print view_status(settings)
def main(): '''Jaiku CLI''' system_args = sys.argv[1:] mode = STATUS_MODE settings = { 'config': 'jaiku.conf', 'xmlrpcurl': 'http: //api.jaiku.com/xmlrpc', 'feedurlstart': 'http: //', 'feedurlend': '.jaiku.com/feed/atom', 'itemdelimeter': '<entry>', 'titledelimeter1': '<title>', 'titledelimeter2': '</title>', 'username': '******', 'personalkey': '', 'location': '' } optlist, args = [], [] try: optlist, args = getopt.getopt( system_args, 'u:p:l:svc:h', [ 'username='******'personal-key=', 'location=', 'status', 'view', 'config=', 'help' ] ) except getopt.GetoptError: usage() for option, value in optlist: if option == '-c' or option == '--config': settings['config'] = value try: configreader.load(open(settings['config'], 'r'), settings) except IOError: pass for option, value in optlist: if option == '-h' or option == '--help': usage() elif option == '-u' or option == '--username': settings['username'] = value elif option == '-p' or option == '--personal-key': settings['personalkey'] = value elif option == '-l' or option == '--location': settings['location'] = value elif option == '-s' or option == '--status': mode = STATUS_MODE elif option == '-v' or option == '--view': mode = VIEW_MODE if mode == STATUS_MODE: if len(args) < 1: usage() message = ' '.join(args) set_status(settings, message) elif mode == VIEW_MODE: print(view_status(settings))