From 48757480aa33ca7a8effd1f99e3b8d3110eaefc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 22 Sep 2012 18:13:27 +0200 Subject: [PATCH] update options and help --- moin2doku.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/moin2doku.py b/moin2doku.py index c3c00e6..bd105ff 100755 --- a/moin2doku.py +++ b/moin2doku.py @@ -75,17 +75,16 @@ def copy_attachments(pagedir, ns): def print_help(): program = sys.argv[0] - print "Usage: %s -m -d " % program + print "Usage: %s OPTIONS" % program print "Convert MoinMoin pages to DokuWiki." print "Options:" - print "-m DIR - MoinMoin pages dir" - print "-d DIR - Dokuwiki pages dir" + print "-d DIR - output directory" print "-a - Convert Attic pages (history)" print "-f - overwrite output files" print "-F FILE - convert single file" print "-r FILE - write config for redirect plugin" 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 sys.exit(0) @@ -228,7 +227,7 @@ def convertfile(pagedir, output = None, overwrite = False): # "main" starts here # 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: print >> sys.stderr, 'Incorrect parameters! Use --help switch to learn more.: %s' % e sys.exit(1) @@ -253,6 +252,10 @@ for o, a in opts: if o == "-F": input_file = a +if not output_dir: + print_help() + sys.exit(1) + print "Output dir is: '%s'" % output_dir init_dirs(output_dir)