From 0ef83911d7e94c6a47b6559e9c3c8bdf7993a10c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 1 Mar 2020 12:08:44 +0100 Subject: rm: Allow specifying multiple paths to remove --- Userland/rm.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Userland') diff --git a/Userland/rm.cpp b/Userland/rm.cpp index b1a55cc18d..5b822095fb 100644 --- a/Userland/rm.cpp +++ b/Userland/rm.cpp @@ -79,12 +79,16 @@ int main(int argc, char** argv) } bool recursive = false; - const char* path = nullptr; + Vector paths; Core::ArgsParser args_parser; args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r'); - args_parser.add_positional_argument(path, "File to remove", "path"); + args_parser.add_positional_argument(paths, "Path(s) to remove", "path"); args_parser.parse(argc, argv); - return remove(recursive, path); + int rc = 0; + for (auto& path : paths) { + rc |= remove(recursive, path); + } + return rc; } -- cgit v1.2.3