ref: refs/heads/master
commit a9de0f9246645e998afedb8bb50c71f2577e99ac
Author: Ján Kupec
Date: Sun Feb 15 20:44:44 2009 +0100
PromptOptions enhancements.
- allow to disable some prompt options
- allow to show only first N options (hide the rest/advanced options)
---
src/output/OutNormal.cc | 2 +
src/output/OutXML.cc | 6 +++-
src/utils/prompt.cc | 66 +++++++++++++++++++++++++++--------------------
src/utils/prompt.h | 31 ++++++++++++++++++++++
4 files changed, 75 insertions(+), 30 deletions(-)
diff --git a/src/output/OutNormal.cc b/src/output/OutNormal.cc
index b189a4b..dc8a62b 100644
--- a/src/output/OutNormal.cc
+++ b/src/output/OutNormal.cc
@@ -252,6 +252,8 @@ void OutNormal::promptHelp(const PromptOptions & poptions)
for(PromptOptions::StrVector::const_iterator it = poptions.options().begin();
it != poptions.options().end(); ++it, ++pos)
{
+ if (poptions.isDisabled(pos))
+ continue;
cout << *it << " - ";
const string & hs_r = poptions.optionHelp(pos);
if (hs_r.empty())
diff --git a/src/output/OutXML.cc b/src/output/OutXML.cc
index 2101259..6d0c584 100644
--- a/src/output/OutXML.cc
+++ b/src/output/OutXML.cc
@@ -74,7 +74,7 @@ void OutXML::info(const string & msg, Verbosity verbosity, Type mask)
{
if (infoWarningFilter(verbosity, mask))
return;
-
+
cout << "" << xml_encode(msg)
<< "</message>" << endl;
}
@@ -123,7 +123,7 @@ void OutXML::writeProgressTag(const string & id, const string & label,
cout << " done=\"" << error << "\"";
// print value only if it is known (percentage progress)
// missing value means 'is-alive' notification
- else if (value >= 0)
+ else if (value >= 0)
cout << " value=\"" << value << "\"";
cout << "/>" << endl;
}
@@ -200,6 +200,8 @@ void OutXML::prompt(PromptId id,
for (PromptOptions::StrVector::const_iterator it = poptions.options().begin();
it != poptions.options().end(); ++it, ++i)
{
+ if (poptions.isDisabled(i))
+ continue;
string option = *it;
cout << "