don't automatically display help on error

it's entirely pointless to flood the user with information and force him
to scroll back when he most likely just made a typo.

apart from that, this reduces the data dependencies, thus easing further
refactoring.

Change-Id: I7b24274d453de54a4f02481a66d77e27d4ab0657
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Oswald Buddenhagen 2013-11-12 19:42:41 +01:00 committed by The Qt Project
parent c9692fbd6e
commit d1990a7132
2 changed files with 11 additions and 16 deletions

9
configure vendored
View File

@ -1357,7 +1357,6 @@ while [ "$#" -gt 0 ]; do
esac
if [ "$UNKNOWN_ARG" = "yes" ]; then
echo "$1: unknown argument"
OPT_HELP=yes
ERROR=yes
shift
continue
@ -2254,7 +2253,6 @@ while [ "$#" -gt 0 ]; do
fi
if [ "$ERROR" = "yes" ]; then
echo "$CURRENT_OPT: unknown argument"
OPT_HELP=yes
fi
;;
v|verbose)
@ -2429,10 +2427,10 @@ while [ "$#" -gt 0 ]; do
esac
if [ "$UNKNOWN_OPT" = "yes" ]; then
echo "${CURRENT_OPT}: invalid command-line switch"
OPT_HELP=yes
ERROR=yes
fi
done
[ "x$ERROR" = "xyes" ] && exit 1
# update QT_CONFIG to show our current predefined configuration
CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h
@ -2454,7 +2452,7 @@ minimal|small|medium|large|full)
echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h"
echo >&2 " or"
echo >&2 " $CFG_QCONFIG_PATH"
OPT_HELP=yes
exit 1
fi
fi
esac
@ -3285,9 +3283,7 @@ fi
# help - interactive parts of the script _after_ this section please
#-------------------------------------------------------------------------------
# next, emit a usage message if something failed.
if [ "$OPT_HELP" = "yes" ]; then
[ "x$ERROR" = "xyes" ] && echo
if [ "$CFG_NIS" = "no" ]; then
NSY=" "
NSN="*"
@ -3781,7 +3777,6 @@ EOF
fi
[ "x$ERROR" = "xyes" ] && exit 1
exit 0
fi # Help

View File

@ -384,7 +384,7 @@ void Configure::parseCmdLine()
configCmdLine.clear();
reloadCmdLine();
} else {
dictionary[ "HELP" ] = "yes";
dictionary[ "DONE" ] = "error";
}
i = 0;
}
@ -1304,7 +1304,7 @@ void Configure::parseCmdLine()
}
else {
dictionary[ "HELP" ] = "yes";
dictionary[ "DONE" ] = "error";
cout << "Unknown option " << configCmdLine.at(i) << endl;
break;
}
@ -1324,7 +1324,7 @@ void Configure::parseCmdLine()
if (dictionary["QMAKESPEC"].toLower() == "features"
|| !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
dictionary[ "HELP" ] = "yes";
dictionary[ "DONE" ] = "error";
if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
} else if (dictionary ["QMAKESPEC_FROM"] == "env") {
@ -1362,10 +1362,10 @@ void Configure::parseCmdLine()
const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive);
if (family.isEmpty()) {
dictionary["HELP"] = "yes";
dictionary[ "DONE" ] = "error";
cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl;
} else if (family.size() > 1) {
dictionary["HELP"] = "yes";
dictionary[ "DONE" ] = "error";
cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl;
@ -1380,7 +1380,7 @@ void Configure::parseCmdLine()
// Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
if (dictionary.contains("XQMAKESPEC") &&
!mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
dictionary["HELP"] = "yes";
dictionary[ "DONE" ] = "error";
cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
}
}
@ -1432,7 +1432,8 @@ void Configure::parseCmdLine()
for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
qtConfig.removeAll(*it);
if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes")
&& (dictionary[ "DONE" ] != "error"))
saveCmdLine();
}
@ -1461,7 +1462,7 @@ void Configure::validateArgs()
if (!QFileInfo::exists(cfgpath)) {
cfgpath = QFileInfo(dictionary["QCONFIG"]).absoluteFilePath();
if (!QFileInfo::exists(cfgpath)) {
dictionary[ "HELP" ] = "yes";
dictionary[ "DONE" ] = "error";
cout << "No such configuration \"" << qPrintable(dictionary["QCONFIG"]) << "\"" << endl ;
return;
}
@ -2825,7 +2826,6 @@ void Configure::generateOutputVars()
cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
<< "be defined as an environment variable, or specified as an" << endl
<< "argument with -platform" << endl;
dictionary[ "HELP" ] = "yes";
QStringList winPlatforms;
QDir mkspecsDir(sourcePath + "/mkspecs");