Skip to content

Commit

Permalink
Fix --no-quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
BlankSpruce committed Nov 29, 2024
1 parent 27f2793 commit db6e611
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gersemirc.example
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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]
Expand All @@ -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
Expand All @@ -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
```
Expand Down
12 changes: 7 additions & 5 deletions gersemi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:
Expand All @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion gersemi/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
__license__ = "MPL 2.0"
__title__ = "gersemi"
__url__ = "https://github.com/BlankSpruce/gersemi"
__version__ = "0.17.0"
__version__ = "0.17.1"
20 changes: 20 additions & 0 deletions tests/test_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit db6e611

Please sign in to comment.