1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-23 19:42:07 +00:00

rm: Allow specifying multiple paths to remove

This commit is contained in:
Andreas Kling 2020-03-01 12:08:44 +01:00
parent 95e3aec719
commit 0ef83911d7

View file

@ -79,12 +79,16 @@ int main(int argc, char** argv)
} }
bool recursive = false; bool recursive = false;
const char* path = nullptr; Vector<const char*> paths;
Core::ArgsParser args_parser; Core::ArgsParser args_parser;
args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r'); 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); args_parser.parse(argc, argv);
return remove(recursive, path); int rc = 0;
for (auto& path : paths) {
rc |= remove(recursive, path);
}
return rc;
} }