mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Userland: Add -v verbose flag to 'cp'
This commit is contained in:
parent
fe79b9ff94
commit
7ba28b5b0b
1 changed files with 4 additions and 0 deletions
|
@ -48,11 +48,13 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool recursion_allowed = false;
|
bool recursion_allowed = false;
|
||||||
|
bool verbose = false;
|
||||||
Vector<const char*> sources;
|
Vector<const char*> sources;
|
||||||
const char* destination = nullptr;
|
const char* destination = nullptr;
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_option(recursion_allowed, "Copy directories recursively", "recursive", 'r');
|
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(sources, "Source file path", "source");
|
||||||
args_parser.add_positional_argument(destination, "Destination file path", "destination");
|
args_parser.add_positional_argument(destination, "Destination file path", "destination");
|
||||||
args_parser.parse(argc, argv);
|
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);
|
bool ok = copy_file_or_directory(source, destination, recursion_allowed);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return 1;
|
return 1;
|
||||||
|
if (verbose)
|
||||||
|
printf("'%s' -> '%s'\n", source, destination);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue