|
3 | 3 | from typing import List, Optional
|
4 | 4 |
|
5 | 5 | import rich_click as click
|
| 6 | +from click.core import Context |
6 | 7 |
|
7 |
| -# from click.core import Context |
8 | 8 | from bumpversion import __version__
|
9 |
| - |
10 |
| -# from bumpversion.aliases import AliasedGroup |
11 |
| -from bumpversion.bump import do_bump, get_next_version |
12 |
| -from bumpversion.config import Config, find_config_file, get_configuration |
| 9 | +from bumpversion.aliases import AliasedGroup |
| 10 | +from bumpversion.bump import do_bump |
| 11 | +from bumpversion.config import find_config_file, get_configuration |
13 | 12 | from bumpversion.logging import setup_logging
|
14 | 13 | from bumpversion.utils import get_context, get_overrides
|
15 | 14 |
|
16 | 15 | logger = logging.getLogger(__name__)
|
17 | 16 |
|
18 | 17 |
|
19 |
| -# @click.group(cls=AliasedGroup) |
20 |
| -# @click.version_option(version=__version__) |
21 |
| -# @click.pass_context |
22 |
| -# def cli(ctx: Context) -> None: |
23 |
| -# """Version bump your Python project.""" |
24 |
| -# if ctx.invoked_subcommand is None: |
25 |
| -# ctx.invoke(bump) |
| 18 | +@click.group( |
| 19 | + cls=AliasedGroup, |
| 20 | + invoke_without_command=True, |
| 21 | + context_settings={ |
| 22 | + "ignore_unknown_options": True, |
| 23 | + "allow_interspersed_args": True, |
| 24 | + }, |
| 25 | +) |
| 26 | +@click.version_option(version=__version__) |
| 27 | +@click.pass_context |
| 28 | +def cli(ctx: Context) -> None: |
| 29 | + """Version bump your Python project.""" |
| 30 | + if ctx.invoked_subcommand is None: |
| 31 | + ctx.invoke(bump, *ctx.args) |
26 | 32 |
|
27 | 33 |
|
28 |
| -@click.command(context_settings={"ignore_unknown_options": True}) |
29 |
| -@click.version_option(version=__version__) |
| 34 | +@cli.command(context_settings={"ignore_unknown_options": True}) |
30 | 35 | @click.argument("args", nargs=-1, type=str)
|
31 | 36 | @click.option(
|
32 | 37 | "--config-file",
|
|
163 | 168 | is_flag=True,
|
164 | 169 | help="List machine readable information",
|
165 | 170 | )
|
166 |
| -def cli( |
| 171 | +def bump( |
167 | 172 | # version_part: str,
|
168 | 173 | args: list,
|
169 | 174 | config_file: Optional[str],
|
|
0 commit comments