def main(cmd, args): """Command Line interface for generating dumps. """ iargs = iter(args) args = [] kwargs = {} for a in iargs: if a.startswith("--"): name = a[2:].replace("-", "_") value = iargs.next() kwargs[name] = value else: args.append(a) if cmd == "cdump": generate_cdump(*args, **kwargs) elif cmd == "dump": generate_dump(*args, **kwargs) elif cmd == "idump": generate_idump(*args, **kwargs) elif cmd == "sort": sort_dump(*args, **kwargs) elif cmd == "split": split_dump(*args, **kwargs) elif cmd == "index": make_index(*args, **kwargs) elif cmd == "bsddb": make_bsddb(*args, **kwargs) elif cmd == "solrdump": import solr solr.generate_dump(*args, **kwargs) elif cmd == "sitemaps": from sitemap import generate_sitemaps generate_sitemaps(*args, **kwargs) elif cmd == "htmlindex": from sitemap import generate_html_index generate_html_index(*args, **kwargs) else: print >> sys.stderr, "Unknown command:", cmd
def main(cmd, args): """Command Line interface for generating dumps. """ iargs = iter(args) args = [] kwargs = {} for a in iargs: if a.startswith('--'): name = a[2:].replace("-", "_") value = iargs.next() kwargs[name] = value else: args.append(a) if cmd == 'cdump': generate_cdump(*args, **kwargs) elif cmd == 'dump': generate_dump(*args, **kwargs) elif cmd == 'idump': generate_idump(*args, **kwargs) elif cmd == 'sort': sort_dump(*args, **kwargs) elif cmd == 'split': split_dump(*args, **kwargs) elif cmd == 'index': make_index(*args, **kwargs) elif cmd == 'bsddb': make_bsddb(*args, **kwargs) elif cmd == "solrdump": import solr solr.generate_dump(*args, **kwargs) elif cmd == 'sitemaps': from sitemap import generate_sitemaps generate_sitemaps(*args, **kwargs) elif cmd == 'htmlindex': from sitemap import generate_html_index generate_html_index(*args, **kwargs) else: print("Unknown command:", cmd, file=sys.stderr)