summaryrefslogtreecommitdiff
path: root/Userland/cp.cpp
diff options
context:
space:
mode:
authorSpencer Dixon <spencercdixon@gmail.com>2020-11-16 20:39:03 -0500
committerAndreas Kling <kling@serenityos.org>2020-11-17 09:40:03 +0100
commit7ba28b5b0ba69f7e1c7e3be60429b3c4b65b90d0 (patch)
treec541e2a801ca0e312c138fa339d61020b8b6ee93 /Userland/cp.cpp
parentfe79b9ff946afacb0e62d51a82de96cafa0b3313 (diff)
downloadserenity-7ba28b5b0ba69f7e1c7e3be60429b3c4b65b90d0.zip
Userland: Add -v verbose flag to 'cp'
Diffstat (limited to 'Userland/cp.cpp')
-rw-r--r--Userland/cp.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/cp.cpp b/Userland/cp.cpp
index a19a883834..915ec3e13b 100644
--- a/Userland/cp.cpp
+++ b/Userland/cp.cpp
@@ -48,11 +48,13 @@ int main(int argc, char** argv)
}
bool recursion_allowed = false;
+ bool verbose = false;
Vector<const char*> sources;
const char* destination = nullptr;
Core::ArgsParser args_parser;
args_parser.add_option(recursion_allowed, "Copy directories recursively", "recursive", 'r');
+ args_parser.add_option(verbose, "Verbose", "verbose", 'v');
args_parser.add_positional_argument(sources, "Source file path", "source");
args_parser.add_positional_argument(destination, "Destination file path", "destination");
args_parser.parse(argc, argv);
@@ -61,6 +63,8 @@ int main(int argc, char** argv)
bool ok = copy_file_or_directory(source, destination, recursion_allowed);
if (!ok)
return 1;
+ if (verbose)
+ printf("'%s' -> '%s'\n", source, destination);
}
return 0;
}