mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
rm: Allow specifying multiple paths to remove
This commit is contained in:
parent
95e3aec719
commit
0ef83911d7
Notes:
sideshowbarker
2024-07-19 08:57:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0ef83911d7e
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…
Reference in a new issue