diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index 3d8e5afaf5..88fb1fb074 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -842,7 +842,7 @@ CastToList::~CastToList() void CloseFdRedirection::dump(int level) const { Node::dump(level); - print_indented(String::format("%d -> Close", m_fd), level); + print_indented(String::formatted("{} -> Close", m_fd), level); } RefPtr CloseFdRedirection::run(RefPtr) @@ -1036,7 +1036,7 @@ DynamicEvaluate::~DynamicEvaluate() void Fd2FdRedirection::dump(int level) const { Node::dump(level); - print_indented(String::format("%d -> %d", m_old_fd, m_new_fd), level); + print_indented(String::formatted("{} -> {}", m_old_fd, m_new_fd), level); } RefPtr Fd2FdRedirection::run(RefPtr) @@ -1066,10 +1066,10 @@ Fd2FdRedirection::~Fd2FdRedirection() void FunctionDeclaration::dump(int level) const { Node::dump(level); - print_indented(String::format("(name: %s)\n", m_name.name.characters()), level + 1); - print_indented("(argument namess)", level + 1); + print_indented(String::formatted("(name: {})\n", m_name.name), level + 1); + print_indented("(argument names)", level + 1); for (auto& arg : m_arguments) - print_indented(String::format("(name: %s)\n", arg.name.characters()), level + 2); + print_indented(String::formatted("(name: {})\n", arg.name), level + 2); print_indented("(body)", level + 1); if (m_block) @@ -2319,7 +2319,7 @@ void PathRedirectionNode::highlight_in_editor(Line::Editor& editor, Shell& shell auto& position = m_path->position(); auto& path = path_text[0]; if (!path.starts_with('/')) - path = String::format("%s/%s", shell.cwd.characters(), path.characters()); + path = String::formatted("{}/{}", shell.cwd, path); auto url = URL::create_with_file_protocol(path); url.set_host(shell.hostname); editor.stylize({ position.start_offset, position.end_offset }, { Line::Style::Hyperlink(url.to_string()) }); @@ -2478,7 +2478,7 @@ void ReadRedirection::dump(int level) const { Node::dump(level); m_path->dump(level + 1); - print_indented(String::format("To %d", m_fd), level + 1); + print_indented(String::formatted("To {}", m_fd), level + 1); } RefPtr ReadRedirection::run(RefPtr shell) @@ -2505,7 +2505,7 @@ void ReadWriteRedirection::dump(int level) const { Node::dump(level); m_path->dump(level + 1); - print_indented(String::format("To/From %d", m_fd), level + 1); + print_indented(String::formatted("To/From {}", m_fd), level + 1); } RefPtr ReadWriteRedirection::run(RefPtr shell) @@ -3135,7 +3135,7 @@ void WriteAppendRedirection::dump(int level) const { Node::dump(level); m_path->dump(level + 1); - print_indented(String::format("From %d", m_fd), level + 1); + print_indented(String::formatted("From {}", m_fd), level + 1); } RefPtr WriteAppendRedirection::run(RefPtr shell) @@ -3162,7 +3162,7 @@ void WriteRedirection::dump(int level) const { Node::dump(level); m_path->dump(level + 1); - print_indented(String::format("From %d", m_fd), level + 1); + print_indented(String::formatted("From {}", m_fd), level + 1); } RefPtr WriteRedirection::run(RefPtr shell) diff --git a/Userland/Shell/Parser.cpp b/Userland/Shell/Parser.cpp index 8cee85c696..0373eef48a 100644 --- a/Userland/Shell/Parser.cpp +++ b/Userland/Shell/Parser.cpp @@ -1782,7 +1782,7 @@ RefPtr Parser::parse_glob() } else { // FIXME: Allow composition of tilde+bareword with globs: '~/foo/bar/baz*' restore_to(saved_offset.offset, saved_offset.line); - bareword_part->set_is_syntax_error(*create(String::format("Unexpected %s inside a glob", bareword_part->class_name().characters()))); + bareword_part->set_is_syntax_error(*create(String::formatted("Unexpected {} inside a glob", bareword_part->class_name()))); return bareword_part; } textbuilder.append(text); diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index aa1ee43812..9091f05ae0 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -171,9 +171,9 @@ String Shell::expand_tilde(const String& expression) if (!home) { auto passwd = getpwuid(getuid()); VERIFY(passwd && passwd->pw_dir); - return String::format("%s/%s", passwd->pw_dir, path.to_string().characters()); + return String::formatted("{}/{}", passwd->pw_dir, path.to_string()); } - return String::format("%s/%s", home, path.to_string().characters()); + return String::formatted("{}/{}", home, path.to_string()); } auto passwd = getpwnam(login_name.to_string().characters()); @@ -181,7 +181,7 @@ String Shell::expand_tilde(const String& expression) return expression; VERIFY(passwd->pw_dir); - return String::format("%s/%s", passwd->pw_dir, path.to_string().characters()); + return String::formatted("{}/{}", passwd->pw_dir, path.to_string()); } bool Shell::is_glob(const StringView& s) @@ -347,7 +347,7 @@ Vector Shell::expand_aliases(Vector initial_commands String Shell::resolve_path(String path) const { if (!path.starts_with('/')) - path = String::format("%s/%s", cwd.characters(), path.characters()); + path = String::formatted("{}/{}", cwd, path); return Core::File::real_path_for(path); } @@ -1249,7 +1249,7 @@ void Shell::cache_path() Core::DirIterator programs(directory.characters(), Core::DirIterator::SkipDots); while (programs.has_next()) { auto program = programs.next_path(); - String program_path = String::format("%s/%s", directory.characters(), program.characters()); + auto program_path = String::formatted("{}/{}", directory, program); auto escaped_name = escape_token(program); if (cached_path.contains_slow(escaped_name)) continue; @@ -1357,7 +1357,7 @@ Vector Shell::complete_path(const String& base, auto file = files.next_path(); if (file.starts_with(token)) { struct stat program_status; - String file_path = String::format("%s/%s", path.characters(), file.characters()); + auto file_path = String::formatted("{}/{}", path, file); int stat_error = stat(file_path.characters(), &program_status); if (!stat_error && (executable_only == ExecutableOnly::No || access(file_path.characters(), X_OK) == 0)) { if (S_ISDIR(program_status.st_mode)) {