diff options
author | Claude Paroz <claude@2xlibre.net> | 2009-06-27 14:57:36 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2009-06-27 14:57:36 +0200 |
commit | 46f8008446aa7efb7ae3bd2facc85cab0ca7d354 (patch) | |
tree | 0cc5cd85fb48ead95d95eafe65607def6b384eb3 /xml2po | |
parent | af6c6108760a9fc0b5d8102fe0d7363c081c13de (diff) | |
download | gnome-doc-utils-46f8008446aa7efb7ae3bd2facc85cab0ca7d354.tar.gz |
[xml2po] Don't return 0 when command line contains errors (Bug #413999)
Diffstat (limited to 'xml2po')
-rwxr-xr-x | xml2po/xml2po.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/xml2po/xml2po.py b/xml2po/xml2po.py index 9ac84cd..5622635 100755 --- a/xml2po/xml2po.py +++ b/xml2po/xml2po.py @@ -713,9 +713,9 @@ if not os.path.exists('/dev/null'): NULL_STRING = 'NUL' import getopt, fileinput def usage (with_help = False): - print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]) - if (with_help): - print >> sys.stderr, """ + print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]) + if with_help: + print >> sys.stderr, """ OPTIONS may be some of: -a --automatic-tags Automatically decides if tags are to be considered "final" or not @@ -746,15 +746,18 @@ EXAMPLES: %s -p de.po chapter1.xml > chapter1.de.xml %s -p de.po chapter2.xml > chapter2.de.xml """ % (sys.argv[0], sys.argv[0], sys.argv[0]) - sys.exit(0) -if len(sys.argv) < 2: usage() +if len(sys.argv) < 2: + usage() + sys.exit(2) args = sys.argv[1:] try: opts, args = getopt.getopt(args, 'avhkem:t:o:p:u:r:l:', ['automatic-tags','version', 'help', 'keep-entities', 'expand-all-entities', 'mode=', 'translation=', 'output=', 'po-file=', 'update-translation=', 'reuse=', 'language=', 'mark-untranslated' ]) -except getopt.GetoptError: usage(True) +except getopt.GetoptError: + usage(True) + sys.exit(2) for opt, arg in opts: if opt in ('-m', '--mode'): @@ -789,7 +792,8 @@ for opt, arg in opts: print VERSION sys.exit(0) elif opt in ('-h', '--help'): - usage(True) + usage(True) + sys.exit(0) # Treat remaining arguments as XML files while args: |