1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00: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

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;
}