22
33import argparse
44import pathlib
5- import sys
5+
6+ from boilerplates .cli import make_copyright_notice , add_version_option
67
78from ._version import VERSION
89from .version import VersionComponent
@@ -18,17 +19,17 @@ def main(args=None, namespace=None) -> None:
1819 prog = 'version_query' ,
1920 description = '''Tool for querying current versions of Python packages. Use LOGGING_LEVEL
2021 environment variable to adjust logging level.''' ,
21- epilog = '''Copyright 2017-2023 by the contributors, Apache License 2.0,
22- https://github.com/mbdevpl/version-query''' ,
22+ epilog = make_copyright_notice (
23+ 2017 , 2024 , author = 'the contributors' , url = ' https://github.com/mbdevpl/version-query') ,
2324 formatter_class = argparse .ArgumentDefaultsHelpFormatter )
25+ add_version_option (parser , VERSION )
26+
2427 parser .add_argument ('-i' , '--increment' , action = 'store_true' , help = '''output version string for
2528 next patch release, i.e. if version is 1.0.3, output 1.0.4''' )
2629 parser .add_argument ('-p' , '--predict' , action = 'store_true' , help = '''operate in prediction mode,
2730 i.e. assume existence of git repository and infer current version from
2831 its tags, history and working tree status''' )
2932 parser .add_argument ('path' , type = pathlib .Path )
30- parser .add_argument ('--version' , action = 'version' ,
31- version = f'{ parser .prog } { VERSION } ,\n Python { sys .version } ' )
3233 parsed_args = parser .parse_args (args = args , namespace = namespace )
3334 if parsed_args .predict and parsed_args .increment :
3435 raise ValueError (
0 commit comments