1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

add more coverage for --quiet cli option

This commit is contained in:
Kelly Brazil
2024-02-12 11:00:27 -08:00
parent 44dc2a74c1
commit f1177a2606
3 changed files with 10 additions and 1 deletions

View File

@ -1,9 +1,11 @@
jc changelog
20240210 v1.25.1
20240212 v1.25.1
- Fix for crash when optional libraries are not installed (e.g. xmltodict)
- Fix for `ini` parser crashing with some keys with no values
- Fix `xrandr` parser to extract more EDID data
- Enhance `uptime` parser to support output with no user information
- Enhance `--quiet` CLI option to cover more warning messages
- Add tests for missing optional libraries
- Documentation updates

View File

@ -861,6 +861,9 @@ class JcCli():
self.set_mono()
self.set_custom_colors()
if self.quiet:
utils.CLI_QUIET = True
if self.verbose_debug:
tracebackplus.enable(context=11) # type: ignore

View File

@ -12,6 +12,7 @@ from functools import lru_cache
from typing import Any, List, Dict, Iterable, Union, Optional, TextIO
from .jc_types import TimeStampFormatType
CLI_QUIET = False
def _asciify(string: str) -> str:
"""
@ -62,6 +63,9 @@ def warning_message(message_lines: List[str]) -> None:
None - just prints output to STDERR
"""
if CLI_QUIET:
return
# this is for backwards compatibility with existing custom parsers
if isinstance(message_lines, str):
message_lines = [message_lines]