* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_commandline
*/
+#include "gmxpre.h"
+
#include "cmdlinehelpwriter.h"
#include <cstring>
#include <boost/scoped_ptr.hpp>
#include "gromacs/commandline/cmdlinehelpcontext.h"
-#include "gromacs/commandline/shellcompletions.h"
#include "gromacs/onlinehelp/helpformat.h"
#include "gromacs/onlinehelp/helpwritercontext.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/utility/file.h"
#include "gromacs/utility/stringutil.h"
+#include "shellcompletions.h"
+
namespace gmx
{
//! Creates a helper object for formatting options.
OptionsListFormatter(const HelpWriterContext &context,
const CommonFormatterData &common,
- bool bConsole);
+ const char *title);
//! Initiates a new section in the options list.
- void startSection(const char *title)
+ void startSection(const char *header)
{
- title_ = title;
+ header_ = header;
bDidOutput_ = false;
}
//! Finishes a section in the options list.
private:
void writeSectionStartIfNecessary()
{
+ if (title_ != NULL)
+ {
+ context_.writeTitle(title_);
+ title_ = NULL;
+ }
if (!bDidOutput_)
{
- if (title_ != NULL)
+ if (header_ != NULL)
{
- context_.writeTitle(title_);
+ context_.writeTextBlock(header_);
}
context_.writeOptionListStart();
}
const CommonFormatterData &common_;
boost::scoped_ptr<TextTableFormatter> consoleFormatter_;
const char *title_;
+ const char *header_;
bool bDidOutput_;
GMX_DISALLOW_COPY_AND_ASSIGN(OptionsListFormatter);
OptionsListFormatter::OptionsListFormatter(
const HelpWriterContext &context,
const CommonFormatterData &common,
- bool bConsole)
- : context_(context), common_(common), title_(NULL), bDidOutput_(false)
+ const char *title)
+ : context_(context), common_(common),
+ title_(title), header_(NULL), bDidOutput_(false)
{
- if (bConsole)
+ if (context.outputFormat() == eHelpOutputFormat_Console)
{
consoleFormatter_.reset(new TextTableFormatter());
consoleFormatter_->setFirstColumnIndent(1);
return;
}
const HelpWriterContext &writerContext = context.writerContext();
- const bool bConsole
- = (writerContext.outputFormat() == eHelpOutputFormat_Console);
OptionsFilter filter;
filter.setShowHidden(context.showHidden());
descriptionFormatter.format(impl_->options_, "Description");
}
CommonFormatterData common(impl_->timeUnit_.c_str());
- OptionsListFormatter formatter(writerContext, common, bConsole);
- formatter.startSection("File Options");
+ OptionsListFormatter formatter(writerContext, common, "Options");
+ formatter.startSection("Options to specify input and output files:[PAR]");
filter.formatSelected(OptionsFilter::eSelectFileOptions,
&formatter, impl_->options_);
formatter.finishSection();
- formatter.startSection("Options");
+ formatter.startSection("Other options:[PAR]");
filter.formatSelected(OptionsFilter::eSelectOtherOptions,
&formatter, impl_->options_);
formatter.finishSection();