Add better suggestions on some bad options.

This commit is contained in:
Wilson Snyder
2021-03-27 13:14:43 -04:00
parent d4d87ef300
commit 05db4e41cd
10 changed files with 104 additions and 13 deletions
+7 -10
View File
@@ -70,8 +70,6 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
// Parse parameters
// Note argc and argv DO NOT INCLUDE the filename in [0]!!!
// May be called recursively when there are -f files.
#define shift \
do { ++i; } while (false)
for (int i = 0; i < argc;) {
UINFO(9, " Option: " << argv[i] << endl);
if (argv[i][0] == '-') {
@@ -89,15 +87,15 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
}
// Parameterized switches
else if (!strcmp(sw, "-annotate-min") && (i + 1) < argc) {
shift;
++i;
m_annotateMin = atoi(argv[i]);
} else if (!strcmp(sw, "-annotate") && (i + 1) < argc) {
shift;
++i;
m_annotateOut = argv[i];
} else if (!strcmp(sw, "-debug")) {
V3Error::debugDefault(3);
} else if (!strcmp(sw, "-debugi") && (i + 1) < argc) {
shift;
++i;
V3Error::debugDefault(atoi(argv[i]));
} else if (!strcmp(sw, "-V")) {
showVersion(true);
@@ -106,22 +104,21 @@ void VlcOptions::parseOptsList(int argc, char** argv) {
showVersion(false);
std::exit(0);
} else if (!strcmp(sw, "-write") && (i + 1) < argc) {
shift;
++i;
m_writeFile = argv[i];
} else if (!strcmp(sw, "-write-info") && (i + 1) < argc) {
shift;
++i;
m_writeInfoFile = argv[i];
} else {
v3fatal("Invalid option: " << argv[i]);
}
shift;
++i;
} // - options
else {
addReadFile(argv[i]);
shift;
++i;
}
}
#undef shift
}
void VlcOptions::showVersion(bool verbose) {