Skip to content

Commit 233e76c

Browse files
committed
Add --version flag to display installed version
1 parent 98c66a5 commit 233e76c

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to PyResolvers will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.4.1] - 2025-01-11
9+
10+
### Added
11+
- Added `--version` and `-V` flags to display installed version
12+
813
## [2.4.0] - 2025-01-11
914

1015
### Changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = '2.4.0'
1+
__version__ = '2.4.1'
22

pyresolvers/lib/core/input.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def parse(self, argv):
171171
@staticmethod
172172
def setup_parser():
173173
"""Setup argument parser."""
174+
from pyresolvers.lib.core.__version__ import __version__
175+
174176
parser = ArgumentParser(
175177
prog='pyresolvers',
176178
description='High-Performance Async DNS Resolver Validator & Speed Tester',
@@ -191,6 +193,12 @@ def setup_parser():
191193
formatter_class=lambda prog: RawDescriptionHelpFormatter(prog, max_help_position=35, width=100)
192194
)
193195

196+
parser.add_argument(
197+
'--version', '-V',
198+
action='version',
199+
version=f'%(prog)s {__version__}'
200+
)
201+
194202
# INPUT OPTIONS
195203
input_group = parser.add_argument_group('Input Options')
196204
targets = input_group.add_mutually_exclusive_group(required=False)

0 commit comments

Comments
 (0)