Skip to content

Commit 0a75f52

Browse files
committed
Make -q hide the welcome message (fixes bpython#1036)
1 parent 064ae93 commit 0a75f52

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

bpython/curtsies.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ def curtsies_arguments(parser: argparse._ArgumentGroup) -> None:
233233
print(bpargs.version_banner())
234234
if banner is not None:
235235
print(banner)
236+
if welcome_message is None and not options.quiet and config.help_key:
237+
welcome_message = (
238+
_("Welcome to bpython!")
239+
+ " "
240+
+ _("Press <%s> for help.") % config.help_key
241+
)
236242

237243
repl = FullCurtsiesRepl(config, locals_, welcome_message, interp)
238244
try:

bpython/curtsiesfrontend/repl.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,6 @@ def __init__(
360360
if interp is None:
361361
interp = Interp(locals=locals_)
362362
interp.write = self.send_to_stdouterr # type: ignore
363-
if banner is None:
364-
if config.help_key:
365-
banner = (
366-
_("Welcome to bpython!")
367-
+ " "
368-
+ _("Press <%s> for help.") % config.help_key
369-
)
370-
else:
371-
banner = None
372363
if config.cli_suggestion_width <= 0 or config.cli_suggestion_width > 1:
373364
config.cli_suggestion_width = 1
374365

@@ -493,15 +484,15 @@ def __init__(
493484
# The methods below should be overridden, but the default implementations
494485
# below can be used as well.
495486

496-
def get_cursor_vertical_diff(self):
487+
def get_cursor_vertical_diff(self) -> int:
497488
"""Return how the cursor moved due to a window size change"""
498489
return 0
499490

500-
def get_top_usable_line(self):
491+
def get_top_usable_line(self) -> int:
501492
"""Return the top line of display that can be rewritten"""
502493
return 0
503494

504-
def get_term_hw(self):
495+
def get_term_hw(self) -> tuple[int, int]:
505496
"""Returns the current width and height of the display area."""
506497
return (50, 10)
507498

0 commit comments

Comments
 (0)