mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
env: add XONSH_SUPPRESS_WELCOME
to suppress welcome msg (#5719)
add `XONSH_SUPPRESS_WELCOME` variable to suppress welcome msg Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
This commit is contained in:
parent
6fefc3c68d
commit
599f1c0f36
3 changed files with 28 additions and 0 deletions
23
news/add-suppress-welcome-env.rst
Normal file
23
news/add-suppress-welcome-env.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* env: Added ``$XONSH_SUPPRESS_WELCOME`` variable to suppress the welcome message.
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -1627,6 +1627,10 @@ class PromptSetting(Xettings):
|
|||
"For example, to have stderr appear on a red background, the "
|
||||
'prefix & postfix pair would be "{BACKGROUND_RED}" & "{RESET}".',
|
||||
)
|
||||
XONSH_SUPPRESS_WELCOME = Var.with_default(
|
||||
False,
|
||||
"Suppresses the welcome message.",
|
||||
)
|
||||
|
||||
|
||||
class PromptHistorySetting(Xettings):
|
||||
|
|
|
@ -548,6 +548,7 @@ def main_xonsh(args):
|
|||
ignore_sigtstp()
|
||||
if (
|
||||
env["XONSH_INTERACTIVE"]
|
||||
and not env["XONSH_SUPPRESS_WELCOME"]
|
||||
and sys.stdin.isatty() # In case the interactive mode is forced but no tty (input from pipe).
|
||||
and not any(os.path.isfile(i) for i in env["XONSHRC"])
|
||||
and not any(os.path.isdir(i) for i in env["XONSHRC_DIR"])
|
||||
|
|
Loading…
Add table
Reference in a new issue