From f23d9a73aa8a69c197f294b6d12b3dfc793bcc1a Mon Sep 17 00:00:00 2001 From: Spencer Dixon Date: Mon, 16 Nov 2020 20:39:30 -0500 Subject: [PATCH] Userland: Add -v verbose flag to 'rm' --- Userland/rm.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/rm.cpp b/Userland/rm.cpp index 087f855ece..d563a294df 100644 --- a/Userland/rm.cpp +++ b/Userland/rm.cpp @@ -82,17 +82,21 @@ int main(int argc, char** argv) bool recursive = false; bool force = false; + bool verbose = false; Vector 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; }