mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
Shell: Add support for showing custom format time in prompt with "\D{}"
This commit is contained in:
parent
e40955e9c6
commit
050c73d301
1 changed files with 9 additions and 0 deletions
|
@ -139,6 +139,15 @@ DeprecatedString Shell::prompt() const
|
||||||
} else if (lexer.consume_specific('@')) {
|
} else if (lexer.consume_specific('@')) {
|
||||||
builder.append(Core::DateTime::now().to_deprecated_string("%I:%M %p"sv));
|
builder.append(Core::DateTime::now().to_deprecated_string("%I:%M %p"sv));
|
||||||
|
|
||||||
|
} else if (lexer.consume_specific("D{"sv)) {
|
||||||
|
auto format = lexer.consume_until('}');
|
||||||
|
if (!lexer.consume_specific('}'))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (format.is_empty())
|
||||||
|
format = "%y-%m-%d"sv;
|
||||||
|
builder.append(Core::DateTime::now().to_deprecated_string(format));
|
||||||
|
|
||||||
} else if (lexer.consume_specific('j')) {
|
} else if (lexer.consume_specific('j')) {
|
||||||
builder.appendff("{}", jobs.size());
|
builder.appendff("{}", jobs.size());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue