2
2
3
3
import argparse
4
4
import pathlib
5
- import sys
5
+
6
+ from boilerplates .cli import make_copyright_notice , add_version_option
6
7
7
8
from ._version import VERSION
8
9
from .version import VersionComponent
@@ -18,17 +19,17 @@ def main(args=None, namespace=None) -> None:
18
19
prog = 'version_query' ,
19
20
description = '''Tool for querying current versions of Python packages. Use LOGGING_LEVEL
20
21
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') ,
23
24
formatter_class = argparse .ArgumentDefaultsHelpFormatter )
25
+ add_version_option (parser , VERSION )
26
+
24
27
parser .add_argument ('-i' , '--increment' , action = 'store_true' , help = '''output version string for
25
28
next patch release, i.e. if version is 1.0.3, output 1.0.4''' )
26
29
parser .add_argument ('-p' , '--predict' , action = 'store_true' , help = '''operate in prediction mode,
27
30
i.e. assume existence of git repository and infer current version from
28
31
its tags, history and working tree status''' )
29
32
parser .add_argument ('path' , type = pathlib .Path )
30
- parser .add_argument ('--version' , action = 'version' ,
31
- version = f'{ parser .prog } { VERSION } ,\n Python { sys .version } ' )
32
33
parsed_args = parser .parse_args (args = args , namespace = namespace )
33
34
if parsed_args .predict and parsed_args .increment :
34
35
raise ValueError (
0 commit comments