Add -q
quiet option
This commit is contained in:
parent
e97b4496c8
commit
17b614a278
11
mcopy.cpp
11
mcopy.cpp
|
@ -18,6 +18,7 @@
|
|||
#endif
|
||||
|
||||
bool ask = true;
|
||||
bool quiet = false;
|
||||
|
||||
void help() {
|
||||
std::cout <<
|
||||
|
@ -25,6 +26,8 @@ void help() {
|
|||
"mcopy -f, --format Specify a format to output files using\n" <<
|
||||
"mcopy -a, --ask Ask the user if metadata cannot be retrieved from file\n" <<
|
||||
"mcopy -na, --no-ask Don't ask if metadata cannot be retrieved from file\n" <<
|
||||
"mcopy -q, --quiet Don't print status messages. Warnings will still be printed\n" <<
|
||||
"mcopy -nq, --no-quiet Print status messages\n" <<
|
||||
"mcopy -h, --help Display help\n" <<
|
||||
"mcopy -v, --version Display version\n" <<
|
||||
"\n" <<
|
||||
|
@ -60,8 +63,6 @@ void getMetadataFromFile(std::string format, std::string str) {
|
|||
std::string artist = tag->artist().to8Bit(true);
|
||||
std::string track = std::to_string(tag->track());
|
||||
|
||||
std::cout << "title: " << title << "\n";
|
||||
|
||||
// If information is missing, ask for the missing details
|
||||
if (title.empty()) {
|
||||
title = "Unknown";
|
||||
|
@ -115,7 +116,7 @@ void getMetadataFromFile(std::string format, std::string str) {
|
|||
if (!std::filesystem::copy_file(str, filename)) {
|
||||
std::cerr << "mcopy: Failed to copy file " << str << " to " << filename << "\n";
|
||||
exit(1);
|
||||
} else {
|
||||
} else if (!quiet) {
|
||||
std::cout << "mcopy: Copied file " << str << " to " << filename << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +140,10 @@ int main(int argc, char **argv) {
|
|||
ask = true;
|
||||
} else if (!arg.compare("-na") || !arg.compare("--no-ask")) {
|
||||
ask = false;
|
||||
} else if (!arg.compare("-q") || !arg.compare("--quiet")) {
|
||||
quiet = true;
|
||||
} else if (!arg.compare("-nq") || !arg.compare("--no-quiet")) {
|
||||
quiet = false;
|
||||
} else if (!arg.compare("-f") || !arg.compare("--format")) {
|
||||
if (argc > i+1) {
|
||||
format = argv[++i];
|
||||
|
|
Loading…
Reference in a new issue