File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 1+ Allow `tools ` to report it's version
Original file line number Diff line number Diff line change 2828from ptscripts import logs
2929from ptscripts import process
3030
31+ try :
32+ import importlib .metadata
33+
34+ __version__ = importlib .metadata .version ("python-tools-scripts" )
35+ except ImportError :
36+ import importlib_metadata
37+
38+ __version__ = importlib_metadata .version ("python-tools-scripts" )
39+
3140if TYPE_CHECKING :
3241 from argparse import ArgumentParser
3342 from argparse import _SubParsersAction
@@ -192,6 +201,7 @@ def __new__(cls):
192201 epilog = "These tools are discovered under `<repo-root>/tools`." ,
193202 allow_abbrev = False ,
194203 )
204+ instance .parser .add_argument ("--version" , action = "version" , version = __version__ )
195205 log_group = instance .parser .add_argument_group ("Logging" )
196206 timestamp_meg = log_group .add_mutually_exclusive_group ()
197207 timestamp_meg .add_argument (
You can’t perform that action at this time.
0 commit comments