Set $fish_private_mode and show a message on private mode startup

The message can be localized and is set as a global variable shadowing
the universally-defined $fish_greeting.
This commit is contained in:
Mahmoud Al-Qudsi
2018-10-21 21:18:27 -05:00
committed by Fabian Homborg
parent 379f44fabe
commit ebb3a3a16e
3 changed files with 8 additions and 1 deletions

View File

@@ -296,7 +296,8 @@ bool string_set_contains(const T &set, const wchar_t *val) {
/// Check if a variable may not be set using the set command.
static bool is_read_only(const wchar_t *val) {
const string_set_t env_read_only = {L"PWD", L"SHLVL", L"history", L"status", L"version", L"fish_pid", L"hostname", L"_"};
const string_set_t env_read_only = {L"PWD", L"SHLVL", L"history", L"status", L"version",
L"fish_pid", L"hostname", L"_", L"fish_private_mode"};
return string_set_contains(env_read_only, val) ||
(in_private_mode() && wcscmp(L"fish_history", val) == 0);
}