mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
rm: Allow specifying multiple paths to remove
This commit is contained in:
parent
95e3aec719
commit
0ef83911d7
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue