From 4fcb3f4f7fc4b54787491c6e0513cc08e9dc9350 Mon Sep 17 00:00:00 2001 From: Takayuki Shimizukawa Date: Fri, 25 Jul 2014 23:33:57 +0200 Subject: [PATCH] `sphinx-apidoc` command now have a `--version` option to show version information and exit. closes #1518 --- CHANGES | 6 ++++++ sphinx/apidoc.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGES b/CHANGES index 127cb545b..84d6fd2a5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ 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 ---------- diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 6c423185c..755ea5efe 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -20,6 +20,7 @@ import optparse from os import path from sphinx.util.osutil import walk +from sphinx import __version__ # automodule options 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', help='Project release, used when --full is given, ' '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:]) + if opts.show_version: + print 'Sphinx (sphinx-apidoc) %s' % __version__ + return 0 + if not args: parser.error('A package path is required.')