qmake: add "undecorated" mode to $$prompt()
the normal mode forces the prompt into a pattern which may be undesirable. Change-Id: I01689c7a6573415801862348b32bafc6a609ed4a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
712a041eb8
commit
cff05b398c
@ -3018,10 +3018,13 @@
|
||||
sum = $$num_add($$first, $$second_neg)
|
||||
\endcode
|
||||
|
||||
\section2 prompt(question)
|
||||
\section2 prompt(question [, decorate])
|
||||
|
||||
Displays the specified \c question, and returns a value read from stdin.
|
||||
|
||||
If \c decorate is \e true (the default), the question gets a generic
|
||||
prefix and suffix identifying it as a prompt.
|
||||
|
||||
\section2 quote(string)
|
||||
|
||||
Converts a whole \c string into a single entity and returns the result.
|
||||
|
@ -1091,16 +1091,22 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand(
|
||||
break;
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
case E_PROMPT: {
|
||||
if (args.count() != 1) {
|
||||
evalError(fL1S("prompt(question) requires one argument."));
|
||||
if (args.count() != 1 && args.count() != 2) {
|
||||
evalError(fL1S("prompt(question, [decorate=true]) requires one or two arguments."));
|
||||
// } else if (currentFileName() == QLatin1String("-")) {
|
||||
// evalError(fL1S("prompt(question) cannot be used when '-o -' is used"));
|
||||
} else {
|
||||
QString msg = m_option->expandEnvVars(args.at(0).toQString(m_tmp1));
|
||||
if (!msg.endsWith(QLatin1Char('?')))
|
||||
msg += QLatin1Char('?');
|
||||
fprintf(stderr, "Project PROMPT: %s ", qPrintable(msg));
|
||||
|
||||
bool decorate = true;
|
||||
if (args.count() == 2)
|
||||
decorate = isTrue(args.at(1));
|
||||
if (decorate) {
|
||||
if (!msg.endsWith(QLatin1Char('?')))
|
||||
msg += QLatin1Char('?');
|
||||
fprintf(stderr, "Project PROMPT: %s ", qPrintable(msg));
|
||||
} else {
|
||||
fputs(qPrintable(msg), stderr);
|
||||
}
|
||||
QFile qfile;
|
||||
if (qfile.open(stdin, QIODevice::ReadOnly)) {
|
||||
QTextStream t(&qfile);
|
||||
|
Loading…
x
Reference in New Issue
Block a user