Skip to content

Commit cd06cbd

Browse files
committed
Refactor CLI config-file option to use @config_option decorator
Replaced the manual `--config-file` option setup with the `@config_option` decorator for cleaner and reusable configuration management. This change simplifies the code and enhances maintainability by consolidating the configuration logic.
1 parent 43f0435 commit cd06cbd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

bumpversion/cli.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from bumpversion import __version__
1212
from bumpversion.bump import do_bump
13+
from bumpversion.click_config import config_option
1314
from bumpversion.config import get_configuration
1415
from bumpversion.config.create import create_configuration
1516
from bumpversion.config.files import find_config_file
@@ -76,12 +77,9 @@ def cli(ctx: Context) -> None:
7677

7778
@cli.command(context_settings={"ignore_unknown_options": True})
7879
@click.argument("args", nargs=-1, type=str)
79-
@click.option(
80+
@config_option(
8081
"--config-file",
81-
metavar="FILE",
82-
required=False,
8382
envvar="BUMPVERSION_CONFIG_FILE",
84-
type=click.Path(exists=True),
8583
help="Config file to read most of the variables from.",
8684
)
8785
@click.option(

0 commit comments

Comments
 (0)