-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from robusta-dev/console-width-parameter
Add --width parameter for the console
- Loading branch information
Showing
4 changed files
with
22 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import sys | ||
|
||
from rich import print as r_print | ||
|
||
from robusta_krr.core.models.config import settings | ||
|
||
py_print = print | ||
|
||
|
||
def print(*objects, rich: bool = True, force: bool = False) -> None: | ||
""" | ||
A wrapper around `rich.print` that prints only if `settings.quiet` is False. | ||
""" | ||
print_func = r_print if rich else py_print | ||
output = sys.stdout if force or not settings.log_to_stderr else sys.stderr | ||
print_func = settings.logging_console.print if rich else print | ||
|
||
if not settings.quiet or force: | ||
print_func(*objects, file=output) # type: ignore | ||
print_func(*objects) # type: ignore | ||
|
||
|
||
__all__ = ["print"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters