diff --git a/news/add-suppress-welcome-env.rst b/news/add-suppress-welcome-env.rst new file mode 100644 index 000000000..1e5e9aa0f --- /dev/null +++ b/news/add-suppress-welcome-env.rst @@ -0,0 +1,23 @@ +**Added:** + +* env: Added ``$XONSH_SUPPRESS_WELCOME`` variable to suppress the welcome message. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/xonsh/environ.py b/xonsh/environ.py index a005e9cd8..b49cd8f56 100644 --- a/xonsh/environ.py +++ b/xonsh/environ.py @@ -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): diff --git a/xonsh/main.py b/xonsh/main.py index fa1fa790d..c833e1456 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -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"])