1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

Userland: Add -v verbose flag to 'rm'

This commit is contained in:
Spencer Dixon 2020-11-16 20:39:30 -05:00 committed by Andreas Kling
parent 2dab9d4bac
commit f23d9a73aa
Notes: sideshowbarker 2024-07-19 01:21:52 +09:00

View file

@ -82,17 +82,21 @@ int main(int argc, char** argv)
bool recursive = false;
bool force = false;
bool verbose = false;
Vector<const char*> paths;
Core::ArgsParser args_parser;
args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r');
args_parser.add_option(force, "Force", "force", 'f');
args_parser.add_option(verbose, "Verbose", "verbose", 'v');
args_parser.add_positional_argument(paths, "Path(s) to remove", "path");
args_parser.parse(argc, argv);
int rc = 0;
for (auto& path : paths) {
rc |= remove(recursive, force, path);
if (verbose && rc == 0)
printf("removed '%s'\n", path);
}
return rc;
}