summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-01 12:08:44 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-01 12:11:31 +0100
commit0ef83911d7e94c6a47b6559e9c3c8bdf7993a10c (patch)
treed5ee4211b305faa843f96dcb6312dd43f2f83126 /Userland
parent95e3aec719f69898cee423dd687149b2d18e6d00 (diff)
downloadserenity-0ef83911d7e94c6a47b6559e9c3c8bdf7993a10c.zip
rm: Allow specifying multiple paths to remove
Diffstat (limited to 'Userland')
-rw-r--r--Userland/rm.cpp10
1 files changed, 7 insertions, 3 deletions
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<const char*> 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;
}