From 0361c8735326e721228b0eb138474db9aac42474 Mon Sep 17 00:00:00 2001 From: kiarina Date: Sun, 9 Feb 2025 20:14:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A4=87=E6=95=B0=E3=81=AE=E3=83=87?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=E8=A8=AD=E5=AE=9A=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=A8=E7=9F=AD=E7=B8=AE=E3=83=98?= =?UTF-8?q?=E3=83=AB=E3=83=97=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=81=AE=E3=82=B5=E3=83=9D=E3=83=BC=E3=83=88=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pydantic_config_builder/__init__.py | 2 +- pydantic_config_builder/cli.py | 15 ++++++++++----- pyproject.toml | 2 +- tests/test_cli.py | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a79ed6..9534dbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.0] - 2024-02-09 + +### Added +- Support for both `pydantic-config-builder.yaml` and `pydantic-config-builder.yml` as default configuration files +- Support for `-h` as an alternative to `--help` for displaying help message + ## [0.2.0] - 2024-02-09 ### Added diff --git a/pydantic_config_builder/__init__.py b/pydantic_config_builder/__init__.py index 83b8385..c5bafcc 100644 --- a/pydantic_config_builder/__init__.py +++ b/pydantic_config_builder/__init__.py @@ -3,4 +3,4 @@ A tool to build YAML configurations by merging multiple files """ -__version__ = "0.2.0" +__version__ = "0.3.0" diff --git a/pydantic_config_builder/cli.py b/pydantic_config_builder/cli.py index 478ab57..92f6dcb 100644 --- a/pydantic_config_builder/cli.py +++ b/pydantic_config_builder/cli.py @@ -8,7 +8,7 @@ from .config import ConfigModel -@click.command() +@click.command(context_settings={"help_option_names": ["-h", "--help"]}) @click.option( "-c", "--config", @@ -25,11 +25,16 @@ def main(config: Path | None, verbose: bool) -> None: """Build YAML configurations by merging multiple files.""" # Use default config file if not specified if config is None: - config = Path("pydantic_config_builder.yml") - if not config.exists(): + # Try both .yaml and .yml extensions + for ext in [".yaml", ".yml"]: + config = Path(f"pydantic-config-builder{ext}") + if config.exists(): + break + else: raise click.ClickException( - "No configuration file specified and " - "pydantic_config_builder.yml not found in current directory" + "No configuration file specified and neither " + "pydantic-config-builder.yaml nor pydantic-config-builder.yml " + "found in current directory" ) if verbose: diff --git a/pyproject.toml b/pyproject.toml index f3cba1b..5fe7421 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pydantic-config-builder" -version = "0.2.0" +version = "0.3.0" description = "A tool to build YAML configurations by merging multiple files" authors = ["kiarina "] license = "MIT" diff --git a/tests/test_cli.py b/tests/test_cli.py index a48b952..9dd05f9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -42,7 +42,7 @@ def test_cli_default_config(temp_dir): runner = CliRunner() with runner.isolated_filesystem(): # Copy test files to current directory - Path("pydantic_config_builder.yml").write_text( + Path("pydantic-config-builder.yml").write_text( (temp_dir / "pydantic_config_builder.yml").read_text() ) Path("base.yaml").write_text((temp_dir / "base.yaml").read_text())