aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/qbs/parser/commandlineoption.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-03-26 11:47:44 +0100
committerChristian Kandeler <christian.kandeler@digia.com>2013-03-26 12:22:54 +0100
commit55b848f530e18ae1f8294f05fb1971aa578dd956 (patch)
tree358b72692e01e255b9749fd461cbfe959aa9b445 /src/app/qbs/parser/commandlineoption.cpp
parenta222a9c4fcbd9b315ea5c759ff09ea89f76ab825 (diff)
Add option to log how much time an operation takes.
This is an interesting information that people might want independently of debugging output. Change-Id: I4a1e3c31cfce6546b43bd2f5f343bf297d764a42 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app/qbs/parser/commandlineoption.cpp')
-rw-r--r--src/app/qbs/parser/commandlineoption.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/src/app/qbs/parser/commandlineoption.cpp b/src/app/qbs/parser/commandlineoption.cpp
index a443afede..7f09c2d76 100644
--- a/src/app/qbs/parser/commandlineoption.cpp
+++ b/src/app/qbs/parser/commandlineoption.cpp
@@ -190,19 +190,31 @@ QString DryRunOption::longRepresentation() const
return QLatin1String("--dry-run");
}
+static QString logTimeRepresentation()
+{
+ return QLatin1String("--log-time");
+}
+
QString ShowProgressOption::description(CommandType command) const
{
Q_UNUSED(command);
- return Tr::tr("%1\n"
+ QString desc = Tr::tr("%1\n"
"\tShow a progress bar. Implies '%2=%3'.\n").arg(longRepresentation(),
loglevelLongRepresentation(), logLevelName(LoggerMinLevel));
+ return desc += Tr::tr("\tThis option is mutually exclusive with '%1'.\n")
+ .arg(logTimeRepresentation());
}
-QString ShowProgressOption::longRepresentation() const
+static QString showProgressRepresentation()
{
return QLatin1String("--show-progress");
}
+QString ShowProgressOption::longRepresentation() const
+{
+ return showProgressRepresentation();
+}
+
void StringListOption::doParse(const QString &representation, QStringList &input)
{
m_arguments = getArgument(representation, input).split(QLatin1Char(','));
@@ -362,4 +374,25 @@ QString RemoveFirstOption::longRepresentation() const
return QLatin1String("--remove-first");
}
+QString LogTimeOption::description(CommandType command) const
+{
+ Q_UNUSED(command);
+ QString desc = Tr::tr("%1\n\tLog the time that the operations involved in this command take.\n")
+ .arg(longRepresentation());
+ desc += Tr::tr("\tThis option is implied in log levels '%1' and higher.\n")
+ .arg(logLevelName(LoggerDebug));
+ return desc += Tr::tr("\tThis options is mutually exclusive with '%1'.\n")
+ .arg(showProgressRepresentation());
+}
+
+QString LogTimeOption::shortRepresentation() const
+{
+ return QLatin1String("-t");
+}
+
+QString LogTimeOption::longRepresentation() const
+{
+ return logTimeRepresentation();
+}
+
} // namespace qbs