summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-10 20:04:20 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-15 22:44:18 +0000
commitcff05b398cb767af7fddae6a617f26f998c7a781 (patch)
tree5ea2b2328997524b1891bd383dfa39f5aeb0582f /qmake
parent712a041eb84f3b0377679f84e78173387480159d (diff)
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>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/doc/src/qmake-manual.qdoc5
-rw-r--r--qmake/library/qmakebuiltins.cpp18
2 files changed, 16 insertions, 7 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc
index b6c950cab6..aa6c8b35cc 100644
--- a/qmake/doc/src/qmake-manual.qdoc
+++ b/qmake/doc/src/qmake-manual.qdoc
@@ -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.
diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp
index 6fe3ba1605..b8df43c5fb 100644
--- a/qmake/library/qmakebuiltins.cpp
+++ b/qmake/library/qmakebuiltins.cpp
@@ -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);