Skip to content

Commit 6d4179b

Browse files
committed
Modified the group command back to a single command.
Will eventually change to a group command, but later.
1 parent fbf85c2 commit 6d4179b

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

bumpversion/cli.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import rich_click as click
66

7+
# from click.core import Context
78
from bumpversion import __version__
8-
from bumpversion.aliases import AliasedGroup
9+
10+
# from bumpversion.aliases import AliasedGroup
911
from bumpversion.bump import do_bump
1012
from bumpversion.config import find_config_file, get_configuration
1113
from bumpversion.logging import setup_logging
@@ -14,14 +16,17 @@
1416
logger = logging.getLogger(__name__)
1517

1618

17-
@click.group(cls=AliasedGroup)
18-
@click.version_option(version=__version__)
19-
def cli() -> None:
20-
"""Version bump your Python project."""
21-
pass
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)
2226

2327

24-
@cli.command(context_settings={"ignore_unknown_options": True})
28+
@click.command(context_settings={"ignore_unknown_options": True})
29+
@click.version_option(version=__version__)
2530
@click.argument("version_part")
2631
@click.argument("files", nargs=-1, type=click.Path())
2732
@click.option(
@@ -135,7 +140,7 @@ def cli() -> None:
135140
required=False,
136141
help="Extra arguments to commit command",
137142
)
138-
def bump(
143+
def cli(
139144
version_part: str,
140145
files: list,
141146
config_file: Optional[str],
@@ -199,7 +204,3 @@ def _log_list(config: dict, new_version: str) -> None:
199204
logger.info("new_version=%s", new_version)
200205
for key, value in config.items():
201206
logger.info("%s=%s", key, value)
202-
203-
204-
if __name__ == "__main__":
205-
cli()

tests/test_cli.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def test_bump_no_configured_files(mocker, tmp_path):
2929
mocked_do_bump = mocker.patch("bumpversion.cli.do_bump")
3030
runner: CliRunner = CliRunner()
3131
with inside_dir(tmp_path):
32-
result: Result = runner.invoke(
33-
cli.cli, ["bump", "--current-version", "1.0.0", "--no-configured-files", "patch"]
34-
)
32+
result: Result = runner.invoke(cli.cli, ["--current-version", "1.0.0", "--no-configured-files", "patch"])
3533

3634
if result.exit_code != 0:
3735
print(result.output)
@@ -47,7 +45,7 @@ def test_no_configured_files_still_file_args_work(mocker, tmp_path):
4745
runner: CliRunner = CliRunner()
4846
with inside_dir(tmp_path):
4947
result: Result = runner.invoke(
50-
cli.cli, ["bump", "--current-version", "1.0.0", "--no-configured-files", "patch", "do-this-file.txt"]
48+
cli.cli, ["--current-version", "1.0.0", "--no-configured-files", "patch", "do-this-file.txt"]
5149
)
5250

5351
if result.exit_code != 0:

0 commit comments

Comments
 (0)