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