update options and help

This commit is contained in:
Elan Ruusamäe 2012-09-22 18:13:27 +02:00
parent 924197ced1
commit 48757480aa

View file

@ -75,17 +75,16 @@ def copy_attachments(pagedir, ns):
def print_help(): def print_help():
program = sys.argv[0] program = sys.argv[0]
print "Usage: %s -m <moinmoin pages directory> -d <output directory>" % program print "Usage: %s OPTIONS" % program
print "Convert MoinMoin pages to DokuWiki." print "Convert MoinMoin pages to DokuWiki."
print "Options:" print "Options:"
print "-m DIR - MoinMoin pages dir" print "-d DIR - output directory"
print "-d DIR - Dokuwiki pages dir"
print "-a - Convert Attic pages (history)" print "-a - Convert Attic pages (history)"
print "-f - overwrite output files" print "-f - overwrite output files"
print "-F FILE - convert single file" print "-F FILE - convert single file"
print "-r FILE - write config for redirect plugin" print "-r FILE - write config for redirect plugin"
print "" print ""
print "%s -m moinmoin/data/pages /var/lib/dokuwiki/pages" % program print "%s -a -d /var/lib/dokuwiki" % program
print "%s -F moinmoin/data/pages/frontpage -d out" % program print "%s -F moinmoin/data/pages/frontpage -d out" % program
sys.exit(0) sys.exit(0)
@ -228,7 +227,7 @@ def convertfile(pagedir, output = None, overwrite = False):
# "main" starts here # "main" starts here
# #
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'hfam:d:F:r:', [ "help" ]) opts, args = getopt.getopt(sys.argv[1:], 'hfad:F:r:', [ "help" ])
except getopt.GetoptError, e: except getopt.GetoptError, e:
print >> sys.stderr, 'Incorrect parameters! Use --help switch to learn more.: %s' % e print >> sys.stderr, 'Incorrect parameters! Use --help switch to learn more.: %s' % e
sys.exit(1) sys.exit(1)
@ -253,6 +252,10 @@ for o, a in opts:
if o == "-F": if o == "-F":
input_file = a input_file = a
if not output_dir:
print_help()
sys.exit(1)
print "Output dir is: '%s'" % output_dir print "Output dir is: '%s'" % output_dir
init_dirs(output_dir) init_dirs(output_dir)