mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
sphinx-build: Provide more specific error messages for invalid arguments.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,6 +1,9 @@
|
||||
Release 1.2 (in development)
|
||||
============================
|
||||
|
||||
* sphinx-build now provides more specific error messages when called with
|
||||
invalid options or arguments.
|
||||
|
||||
* sphinx-build now supports the standard :option:`--help` and
|
||||
:option:`--version` options.
|
||||
|
||||
|
||||
@@ -97,15 +97,18 @@ def main(argv):
|
||||
if not path.isdir(outdir):
|
||||
print >>sys.stderr, 'Making output directory...'
|
||||
os.makedirs(outdir)
|
||||
except (IndexError, getopt.error):
|
||||
usage(argv)
|
||||
except getopt.error, err:
|
||||
usage(argv, 'Error: %s' % err)
|
||||
return 1
|
||||
except IndexError:
|
||||
usage(argv, 'Error: Insufficient arguments.')
|
||||
return 1
|
||||
|
||||
filenames = args[2:]
|
||||
err = 0
|
||||
for filename in filenames:
|
||||
if not path.isfile(filename):
|
||||
print >>sys.stderr, 'Cannot find file %r.' % filename
|
||||
print >>sys.stderr, 'Error: Cannot find file %r.' % filename
|
||||
err = 1
|
||||
if err:
|
||||
return 1
|
||||
@@ -132,7 +135,7 @@ def main(argv):
|
||||
buildername = val
|
||||
elif opt == '-a':
|
||||
if filenames:
|
||||
usage(argv, 'Cannot combine -a option and filenames.')
|
||||
usage(argv, 'Error: Cannot combine -a option and filenames.')
|
||||
return 1
|
||||
force_all = True
|
||||
elif opt == '-t':
|
||||
|
||||
Reference in New Issue
Block a user