mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
Shell: Add support for showing custom format time in prompt with "\D{}"
This commit is contained in:
parent
e40955e9c6
commit
050c73d301
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/adamjoer
Commit: 050c73d301
Pull-request: https://github.com/SerenityOS/serenity/pull/21589
Reviewed-by: https://github.com/alimpfard
1 changed files with 9 additions and 0 deletions
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue