def track(args): if len(args) == 0: print formatDefinitions(defaults, 80) return try: config, files = parseargs(args, defaults, 0, 0) except ValueError, e: print 'error: ' + str(e) print 'run with no arguments for parameter explanations' return
def download(params, filefunc, statusfunc, finfunc, errorfunc, doneflag, cols, pathFunc=None, paramfunc=None, spewflag=Event()): if len(params) == 0: errorfunc('arguments are -\n' + formatDefinitions(defaults, cols)) return try: config, args = parseargs(params, defaults, 0, 1) if args: if config.get('responsefile', None) == None: raise ValueError, 'must have responsefile as arg or parameter, not both' if path.isfile(args[0]): config['responsefile'] = args[0] else: config['url'] = args[0] if (config['responsefile'] == '') == (config['url'] == ''): raise ValueError, 'need responsefile or url' except ValueError, e: errorfunc('error: ' + str(e) + '\nrun with no args for parameter explanations') return
def download(params, filefunc, statusfunc, finfunc, errorfunc, doneflag, cols, pathFunc = None, paramfunc = None, spewflag = Event()): if len(params) == 0: errorfunc('arguments are -\n' + formatDefinitions(defaults, cols)) return try: config, args = parseargs(params, defaults, 0, 1) if args: if config.get('responsefile', None) == None: raise ValueError, 'must have responsefile as arg or parameter, not both' if path.isfile(args[0]): config['responsefile'] = args[0] else: config['url'] = args[0] if (config['responsefile'] == '') == (config['url'] == ''): raise ValueError, 'need responsefile or url' except ValueError, e: errorfunc('error: ' + str(e) + '\nrun with no args for parameter explanations') return
def get_usage(defaults=defaults, cols=100, presets={}): return (argslistheader + formatDefinitions(defaults, cols, presets))