mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
sphinx-apidoc command now have a --version option to show version information and exit. closes #1518
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -1,6 +1,12 @@
|
|||||||
Release 1.2.3 (in development)
|
Release 1.2.3 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
Features added
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* #1518: `sphinx-apidoc` command now have a `--version` option to show version
|
||||||
|
information and exit
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import optparse
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from sphinx.util.osutil import walk
|
from sphinx.util.osutil import walk
|
||||||
|
from sphinx import __version__
|
||||||
|
|
||||||
# automodule options
|
# automodule options
|
||||||
if 'SPHINX_APIDOC_OPTIONS' in os.environ:
|
if 'SPHINX_APIDOC_OPTIONS' in os.environ:
|
||||||
@@ -300,9 +301,15 @@ Note: By default this script will not overwrite already created files.""")
|
|||||||
parser.add_option('-R', '--doc-release', action='store', dest='release',
|
parser.add_option('-R', '--doc-release', action='store', dest='release',
|
||||||
help='Project release, used when --full is given, '
|
help='Project release, used when --full is given, '
|
||||||
'defaults to --doc-version')
|
'defaults to --doc-version')
|
||||||
|
parser.add_option('--version', action='store_true', dest='show_version',
|
||||||
|
help='Show version information and exit')
|
||||||
|
|
||||||
(opts, args) = parser.parse_args(argv[1:])
|
(opts, args) = parser.parse_args(argv[1:])
|
||||||
|
|
||||||
|
if opts.show_version:
|
||||||
|
print 'Sphinx (sphinx-apidoc) %s' % __version__
|
||||||
|
return 0
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
parser.error('A package path is required.')
|
parser.error('A package path is required.')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user