/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_COMMANDLINE_CMDLINEHELPCONTEXT_H
#define GMX_COMMANDLINE_CMDLINEHELPCONTEXT_H
-#include "../onlinehelp/helpwritercontext.h"
-#include "../utility/common.h"
+#include "gromacs/onlinehelp/helpwritercontext.h"
+#include "gromacs/utility/common.h"
namespace gmx
{
+class ShellCompletionWriter;
+
/*! \libinternal \brief
* Context information for writing out command-line help.
*
* onlinehelp module is not exposed to extra features of the command-line help
* export.
*
+ * Copying a context works like with HelpWriterContext: the output file and
+ * most state is shared. However, setModuleDisplayName() and setShowHidden()
+ * can be set independently for the child context. Defaults for these options
+ * are inherited from the parent.
+ *
* \ingroup module_commandline
*/
class CommandLineHelpContext
{
public:
/*! \brief
- * Creates the context.
+ * Creates a context for help export.
*
* Wraps the constructor of HelpWriterContext.
*/
CommandLineHelpContext(File *file, HelpOutputFormat format,
const HelpLinks *links);
+ //! Creates a context for a particular HelpWriterContext.
+ explicit CommandLineHelpContext(const HelpWriterContext &writerContext);
+ /*! \brief
+ * Creates a context for shell completion.
+ */
+ explicit CommandLineHelpContext(ShellCompletionWriter *writer);
+ //! Creates a copy of the context.
+ explicit CommandLineHelpContext(const CommandLineHelpContext &other);
~CommandLineHelpContext();
/*! \brief
const char *moduleDisplayName() const;
//! Returns whether hidden options should be shown in help output.
bool showHidden() const;
+ //! Returns whether this context is for exporting shell completions.
+ bool isCompletionExport() const;
+ /*! \brief
+ * Returns the shell completion writer for this context.
+ *
+ * Can only be called if isCompletionExport() returns `true`.
+ */
+ ShellCompletionWriter &shellCompletionWriter() const;
private:
class Impl;
PrivateImplPointer<Impl> impl_;
+
+ GMX_DISALLOW_ASSIGN(CommandLineHelpContext);
};
/*! \libinternal \brief