mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 05:17:34 +00:00
Shell: Support HISTFILE environment variable
This allows changing the Shell's history file path.
This commit is contained in:
parent
b2e4fe1299
commit
4a4b1b1131
2 changed files with 10 additions and 7 deletions
|
@ -15,10 +15,16 @@ Such variables can be changed or set by the user to tweak how the shell presents
|
||||||
|
|
||||||
The value of this variable is used to join lists or split strings into lists, its default value is a newline (`\\n`).
|
The value of this variable is used to join lists or split strings into lists, its default value is a newline (`\\n`).
|
||||||
|
|
||||||
|
2. History
|
||||||
|
|
||||||
|
`HISTFILE` (environment)
|
||||||
|
|
||||||
|
The value of this variable is used as the Shell's history file path, both for reading history at startup and writing history on exit.
|
||||||
|
Its default value is `~/.history`.
|
||||||
|
|
||||||
## Visual
|
## Visual
|
||||||
|
|
||||||
2. Prompting
|
1. Prompting
|
||||||
|
|
||||||
`PROMPT` (environment)
|
`PROMPT` (environment)
|
||||||
|
|
||||||
|
@ -30,8 +36,6 @@ The value of this variable is used to generate a prompt, the following escape se
|
||||||
|
|
||||||
Any other escaped character shall be ignored.
|
Any other escaped character shall be ignored.
|
||||||
|
|
||||||
|
|
||||||
`PROMPT_EOL_MARK` (environment)
|
`PROMPT_EOL_MARK` (environment)
|
||||||
|
|
||||||
The value of this variable is used to denote the ends of partial lines (lines with no newline), its default value is '%'.
|
The value of this variable is used to denote the ends of partial lines (lines with no newline), its default value is '%'.
|
||||||
|
|
||||||
|
|
|
@ -960,10 +960,9 @@ void Shell::block_on_job(RefPtr<Job> job)
|
||||||
|
|
||||||
String Shell::get_history_path()
|
String Shell::get_history_path()
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
if (auto histfile = getenv("HISTFILE"))
|
||||||
builder.append(home);
|
return { histfile };
|
||||||
builder.append("/.history");
|
return String::formatted("{}/.history", home);
|
||||||
return builder.to_string();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String Shell::escape_token(const String& token)
|
String Shell::escape_token(const String& token)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue