From 2dab9d4bac20fdf961b3e60fa0ea13611da047b2 Mon Sep 17 00:00:00 2001 From: Spencer Dixon Date: Mon, 16 Nov 2020 20:39:18 -0500 Subject: [PATCH] Userland: Add -v verbose flag to 'mv' --- Userland/mv.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/mv.cpp b/Userland/mv.cpp index 09c16bf0df..0b1cb18db2 100644 --- a/Userland/mv.cpp +++ b/Userland/mv.cpp @@ -41,12 +41,14 @@ int main(int argc, char** argv) // NOTE: The "force" option is a dummy for now, it's just here to silence scripts that use "mv -f" // In the future, it might be used to cancel out an "-i" interactive option. bool force = false; + bool verbose = false; const char* old_path = nullptr; const char* new_path = nullptr; Core::ArgsParser args_parser; args_parser.add_option(force, "Force", "force", 'f'); + args_parser.add_option(verbose, "Verbose", "verbose", 'v'); args_parser.add_positional_argument(old_path, "The file or directory being moved", "source"); args_parser.add_positional_argument(new_path, "destination of the move operation", "destination"); args_parser.parse(argc, argv); @@ -71,5 +73,9 @@ int main(int argc, char** argv) perror("rename"); return 1; } + + if (verbose) + printf("renamed '%s' -> '%s'\n", old_path, new_path); + return 0; }