diff --git a/.gersemirc.example b/.gersemirc.example index a93b575..a721d97 100644 --- a/.gersemirc.example +++ b/.gersemirc.example @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.17.0/gersemi/configuration.schema.json +# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.17.1/gersemi/configuration.schema.json definitions: [] disable_formatting: false diff --git a/CHANGELOG.md b/CHANGELOG.md index ababca0..c8e7fdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## [0.17.1] 2024-11-29 +### Fixed +- fix `--no-quiet` (#43) + ## [0.17.0] 2024-10-26 ### Added - Add `disable_formatting`. (#35) diff --git a/README.md b/README.md index bc8d45c..8f506a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # gersemi -[![Status](https://github.com/BlankSpruce/gersemi/workflows/Tests/badge.svg?branch=master)](https://github.com/BlankSpruce/gersemi/actions) [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Status](https://github.com/BlankSpruce/gersemi/workflows/Tests/badge.svg)](https://github.com/BlankSpruce/gersemi/actions) [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) A formatter to make your CMake code the real treasure. @@ -90,7 +90,7 @@ outcome configuration: When enabled file which has unknown custom commands will have warnings issued about that and result won't be cached. See: "Let's make a deal" section in README. [default: warnings - enabled] + enabled, same as --warn-about-unknown-commands] --disable-formatting, --enable-formatting Completely disable formatting. [default: formatting enabled] @@ -101,17 +101,18 @@ control configuration: (defaults) -q, --quiet, --no-quiet - Skip printing non-error messages to stderr. - [default: don't skip] + Skip printing non-error messages to stderr. + [default: don't skip, same as --no-quiet] --color, --no-color If --diff is selected showed diff is colorized. Colorama has to - be installed for this option to work. - [default: don't colorize diff] + be installed for this option to work. + [default: don't colorize diff, same as --no-color] -w (INTEGER | max), --workers (INTEGER | max) Explicit number of workers or 'max' for maximum possible number of workers on given machine used to format multiple files in parallel. [default: max] --cache, --no-cache Enables cache with data about files that are known to be - formatted to speed up execution. [default: cache enabled] + formatted to speed up execution. + [default: cache enabled, same as --cache] --config CONFIGURATION_FILE Path to configuration file. When present this configuration file will be used for determining configuration for all sources @@ -125,7 +126,7 @@ You can use gersemi with a pre-commit hook by adding the following to `.pre-comm ```yaml repos: - repo: https://github.com/BlankSpruce/gersemi - rev: 0.17.0 + rev: 0.17.1 hooks: - id: gersemi ``` diff --git a/gersemi/__main__.py b/gersemi/__main__.py index 0538664..f605914 100644 --- a/gersemi/__main__.py +++ b/gersemi/__main__.py @@ -166,7 +166,7 @@ def create_argparser(): default=None, help=f""" {outcome_conf_doc["warn_about_unknown_commands"]} - [default: warnings enabled] + [default: warnings enabled, same as --warn-about-unknown-commands] """, ) outcome_configuration_group.add_argument( @@ -193,8 +193,10 @@ def create_argparser(): "--quiet", "--no-quiet", dest="quiet", - action="store_true", - help=f"{control_conf_doc['quiet']} [default: don't skip]", + action=toggle_with_no_prefix, + nargs=0, + default=None, + help=f"{control_conf_doc['quiet']} [default: don't skip, same as --no-quiet]", ) if colorama_version == MISSING: @@ -212,7 +214,7 @@ def create_argparser(): help=f""" {control_conf_doc['color']} {warn_about_missing_colorama} - [default: don't colorize diff] + [default: don't colorize diff, same as --no-color] """, ) control_configuration_group.add_argument( @@ -234,7 +236,7 @@ def create_argparser(): default=None, help=f""" {control_conf_doc["cache"]} - [default: cache enabled] + [default: cache enabled, same as --cache] """, ) control_configuration_group.add_argument( diff --git a/gersemi/__version__.py b/gersemi/__version__.py index a14350e..e27a18a 100644 --- a/gersemi/__version__.py +++ b/gersemi/__version__.py @@ -4,4 +4,4 @@ __license__ = "MPL 2.0" __title__ = "gersemi" __url__ = "https://github.com/BlankSpruce/gersemi" -__version__ = "0.17.0" +__version__ = "0.17.1" diff --git a/tests/test_executable.py b/tests/test_executable.py index fca06e7..6951903 100644 --- a/tests/test_executable.py +++ b/tests/test_executable.py @@ -689,6 +689,26 @@ def test_check_project_with_conflicting_command_definitions(app, testfiles): """, ) + assert app("--check", "--no-quiet", base, "--definitions", base) == success( + stdout="", + stderr=f"""Warning: conflicting definitions for 'foo': +(used) {foo1}:1:10 +(ignored) {foo2}:1:10 +(ignored) {foo2}:5:10 +(ignored) {foo2}:9:10 +""", + ) + + +def test_check_project_with_conflicting_command_definitions_dont_warn_when_quiet( + app, testfiles +): + base = testfiles / "conflicting_definitions" + assert app("--check", "--quiet", base, "--definitions", base) == success( + stdout="", + stderr="", + ) + def test_format_file_with_conflicting_command_definitions(app, testfiles): base = testfiles / "conflicting_definitions"