mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 23:57:25 +00:00
Shell: Add support for showing custom format time in prompt with "\D{}"
This commit is contained in:
committed by
Ali Mohammad Pur
parent
e40955e9c6
commit
050c73d301
@@ -139,6 +139,15 @@ DeprecatedString Shell::prompt() const
|
||||
} else if (lexer.consume_specific('@')) {
|
||||
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')) {
|
||||
builder.appendff("{}", jobs.size());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user