*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * 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.
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+/*! \internal \file
+ * \brief
+ * Declares gmx::ShellCompletionWriter.
+ *
+ * \author Teemu Murtola <teemu.murtola@gmail.com> (C++ interface)
+ */
#ifndef GMX_COMMANDLINE_SHELLCOMPLETIONS_H
#define GMX_COMMANDLINE_SHELLCOMPLETIONS_H
+#include <string>
+#include <vector>
+
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/filenm.h"
+#include "gromacs/utility/common.h"
+
+namespace gmx
+{
+
+class CommandLineHelpContext;
+class File;
+class Options;
+
+//! \cond internal
+//! \addtogroup module_onlinehelp
+//! \{
+
+//! Output format for ShellCompletionWriter.
+enum ShellCompletionFormat
+{
+ eShellCompletionFormat_Bash //!< Shell completions for bash.
+};
+
+//! \}
+//! \endcond
+
+class ShellCompletionWriter
+{
+ public:
+ typedef std::vector<std::string> ModuleNameList;
+
+ ShellCompletionWriter(const std::string &binaryName,
+ ShellCompletionFormat format);
+ ~ShellCompletionWriter();
+
+ File *outputFile();
+
+ void startCompletions();
+ void writeLegacyModuleCompletions(const char *moduleName,
+ int nfile, t_filenm *fnm,
+ int npargs, t_pargs *pa);
+ void writeModuleCompletions(const char *moduleName,
+ const Options &options);
+ void writeWrapperCompletions(const ModuleNameList &modules);
+ void finishCompletions();
+
+ private:
+ class Impl;
+
+ PrivateImplPointer<Impl> impl_;
+};
-void write_completions(const char *type, const char *program,
- int nfile, t_filenm *fnm,
- int npargs, t_pargs *pa);
+} // namespace gmx
#endif