Skip to content

Commit

Permalink
Expose --version-info
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Jun 2, 2024
1 parent 14313ee commit 8801663
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## Version 1.1.5 - Unreleased

### Changed
* Minor modification to `xdoctest --version-info` and exposed it in CLI help.


## Version 1.1.4 - Released 2024-05-31

Expand Down
10 changes: 6 additions & 4 deletions src/xdoctest/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ def main(argv=None):
argv = sys.argv

version_info = {
'version': xdoctest.__version__,
'sys_version': sys.version,
'version': xdoctest.__version__,
}

if '--version' in argv:
print(version_info['version'])
return 0

if '--version-info' in argv:
for key, value in sorted(version_info.items()):
print('{} = {}'.format(key, value))
print('sys_version = {}'.format(version_info['sys_version']))
print('file = {}'.format(__file__))
print('version = {}'.format(version_info['version']))
return 0

import argparse
Expand Down Expand Up @@ -69,7 +70,8 @@ class RawDescriptionDefaultsHelpFormatter(
If the `--command` key / value pair is unspecified, the first
positional argument is used as the command.
'''))
parser.add_argument('--version', action='store_true', help='Display version info and quit')
parser.add_argument('--version', action='store_true', help='Display version and quit')
parser.add_argument('--version-info', action='store_true', help='Display version and other info and quit')

# The bulk of the argparse CLI is defined in the doctest example
from xdoctest import doctest_example
Expand Down

0 comments on commit 8801663

Please sign in to comment.