Skip to content

Commit

Permalink
Use console width when wrapping help (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Apr 10, 2021
1 parent 361b11a commit b276841
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from mk._typer import CustomTyper
from mk.ctx import ctx

app = CustomTyper()
handlers: List[logging.Handler]
console_err = Console(stderr=True)
app = CustomTyper(width=console_err.width)

if "_MK_COMPLETE" in os.environ:
level = logging.CRITICAL
Expand Down
6 changes: 5 additions & 1 deletion src/mk/_typer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ def __init__(
self,
*args,
cls=CustomHelpColorsGroup,
context_settings={"help_option_names": ["-h", "--help"]},
context_settings={
"help_option_names": ["-h", "--help"],
},
width: int = 80,
**kwargs
) -> None:
context_settings["max_content_width"] = width
super().__init__(
*args, cls=cls, context_settings=context_settings, no_args_is_help=True, **kwargs
)
Expand Down

0 comments on commit b276841

Please sign in to comment.