diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-07 20:45:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-07 21:12:09 +0200 |
commit | 8c3b603da389fc5c2ac0c438ee681c5e2ddb3f00 (patch) | |
tree | 4e03dbae3e3c6de6af474f9ac8ccb77c3f269321 | |
parent | ea027834df32cb4ae8aabd59849c0c51847cd5b6 (diff) | |
download | serenity-8c3b603da389fc5c2ac0c438ee681c5e2ddb3f00.zip |
Shell: Convert StringBuilder::appendf() => AK::Format
-rw-r--r-- | Userland/Shell/Builtin.cpp | 4 | ||||
-rw-r--r-- | Userland/Shell/Formatter.cpp | 12 | ||||
-rw-r--r-- | Userland/Shell/Shell.cpp | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index 630dfaaa19..d03b47a56f 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -710,7 +710,7 @@ int Shell::builtin_pushd(int argc, const char** argv) if (argv[1][0] == '/') { path_builder.append(argv[1]); } else { - path_builder.appendf("%s/%s", cwd.characters(), argv[1]); + path_builder.appendff("{}/{}", cwd, argv[1]); } } else if (argc == 3) { directory_stack.append(cwd.characters()); @@ -721,7 +721,7 @@ int Shell::builtin_pushd(int argc, const char** argv) if (arg[0] == '/') { path_builder.append(arg); } else - path_builder.appendf("%s/%s", cwd.characters(), arg); + path_builder.appendff("{}/{}", cwd, arg); } if (!strcmp(arg, "-n")) diff --git a/Userland/Shell/Formatter.cpp b/Userland/Shell/Formatter.cpp index 10450be0ad..f005a2c71d 100644 --- a/Userland/Shell/Formatter.cpp +++ b/Userland/Shell/Formatter.cpp @@ -242,7 +242,7 @@ void Formatter::visit(const AST::CloseFdRedirection* node) test_and_update_output_cursor(node); TemporaryChange<const AST::Node*> parent { m_parent_node, node }; - current_builder().appendf("%d>&-", node->fd()); + current_builder().appendff("{}>&-", node->fd()); visited(node); } @@ -307,7 +307,7 @@ void Formatter::visit(const AST::Fd2FdRedirection* node) test_and_update_output_cursor(node); TemporaryChange<const AST::Node*> parent { m_parent_node, node }; - current_builder().appendf("%d>&%d", node->source_fd(), node->dest_fd()); + current_builder().appendff("{}>&{}", node->source_fd(), node->dest_fd()); if (m_hit_node == node) ++m_output_cursor; visited(node); @@ -673,7 +673,7 @@ void Formatter::visit(const AST::ReadRedirection* node) TemporaryChange<const AST::Node*> parent { m_parent_node, node }; if (node->fd() != 0) - current_builder().appendf(" %d<", node->fd()); + current_builder().appendff(" {}<", node->fd()); else current_builder().append(" <"); NodeVisitor::visit(node); @@ -687,7 +687,7 @@ void Formatter::visit(const AST::ReadWriteRedirection* node) TemporaryChange<const AST::Node*> parent { m_parent_node, node }; if (node->fd() != 0) - current_builder().appendf(" %d<>", node->fd()); + current_builder().appendff(" {}<>", node->fd()); else current_builder().append(" <>"); NodeVisitor::visit(node); @@ -878,7 +878,7 @@ void Formatter::visit(const AST::WriteAppendRedirection* node) TemporaryChange<const AST::Node*> parent { m_parent_node, node }; if (node->fd() != 1) - current_builder().appendf(" %d>>", node->fd()); + current_builder().appendff(" {}>>", node->fd()); else current_builder().append(" >>"); NodeVisitor::visit(node); @@ -892,7 +892,7 @@ void Formatter::visit(const AST::WriteRedirection* node) TemporaryChange<const AST::Node*> parent { m_parent_node, node }; if (node->fd() != 1) - current_builder().appendf(" %d>", node->fd()); + current_builder().appendff(" {}>", node->fd()); else current_builder().append(" >"); NodeVisitor::visit(node); diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 6fb94ba7a4..c0e2b5c998 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -77,8 +77,8 @@ String Shell::prompt() const return "# "; StringBuilder builder; - builder.appendf("\033]0;%s@%s:%s\007", username.characters(), hostname, cwd.characters()); - builder.appendf("\033[31;1m%s\033[0m@\033[37;1m%s\033[0m:\033[32;1m%s\033[0m$> ", username.characters(), hostname, cwd.characters()); + builder.appendff("\033]0;{}@{}:{}\007", username, hostname, cwd); + builder.appendff("\033[31;1m{}\033[0m@\033[37;1m{}\033[0m:\033[32;1m{}\033[0m$> ", username, hostname, cwd); return builder.to_string(); } |