mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 10:01:13 +09:00
Shell: Add support for showing current time in prompt with "\{t|T|@}"
This commit is contained in:
parent
3d42e68265
commit
e40955e9c6
Notes:
sideshowbarker
2024-07-18 04:46:35 +09:00
Author: https://github.com/adamjoer
Commit: e40955e9c6
Pull-request: https://github.com/SerenityOS/serenity/pull/21589
Reviewed-by: https://github.com/alimpfard
1 changed files with 10 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Event.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
|
@ -129,6 +130,15 @@ DeprecatedString Shell::prompt() const
|
|||
} else if (lexer.consume_specific('p')) {
|
||||
builder.append(uid == 0 ? '#' : '$');
|
||||
|
||||
} else if (lexer.consume_specific('t')) {
|
||||
builder.append(Core::DateTime::now().to_deprecated_string("%H:%M:%S"sv));
|
||||
|
||||
} else if (lexer.consume_specific('T')) {
|
||||
builder.append(Core::DateTime::now().to_deprecated_string("%I:%M:%S"sv));
|
||||
|
||||
} else if (lexer.consume_specific('@')) {
|
||||
builder.append(Core::DateTime::now().to_deprecated_string("%I:%M %p"sv));
|
||||
|
||||
} else if (lexer.consume_specific('j')) {
|
||||
builder.appendff("{}", jobs.size());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue