r109757 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109756‎ | r109757 | r109758 >
Date:21:06, 22 January 2012
Author:adamw
Status:deferred
Tags:
Comment:
outline cmdline options for mwimport.py
Modified paths:
  • /trunk/extensions/Offline/mwimport.py (modified) (history)

Diff [purge]

Index: trunk/extensions/Offline/mwimport.py
@@ -223,8 +223,30 @@
224224
225225
226226 if __name__ == "__main__":
227 - #op = OptionParser()
228 - #op.add_option(
 227+ op = OptionParser()
 228+ op.add_option("-d", "--dir", dest="base_dir",
 229+ help="base directory for output files")
 230+ #op.add_option("-f", "--force", dest="force", action="store_true",
 231+ # help="ignore processing errors")
 232+ #op.add_option("-s", "--skip", dest="skip", type="int",
 233+ # help="skip over this many articles before begining import")
 234+ #op.add_option("--import", dest="do_sql", action="store_true",
 235+ # help="run sql import script when finished with dump")
 236+ #op.add_option("--no-import", dest="do_sql", action="store_false",
 237+ # help="stop after dump, do not import sql")
 238+ #op.add_option("--ignore-existing", dest="replace", action="store_false",
 239+ # help="no not overwrite existing data")
 240+ #op.add_option("--replace-existing", dest="replace", action="store_true",
 241+ # help="generated sql statements will overwrite existing data")
 242+ options, args = op.parse_args()
229243
230 - p = DumpParser()
 244+ if len(args) > 1:
 245+ print "too many input file arguments provided: "+" ".join(args)
 246+ sys.exit(-1)
 247+ elif len(args) == 0 or args[0] == '-':
 248+ f = sys.stdin
 249+ else:
 250+ f = open(args[0])
 251+
 252+ p = DumpParser(input=f, output_base=options.base_dir)
231253 p.parse()

Status & tagging log