Shell completion export from the wrapper binary
[alexxy/gromacs.git] / src / gromacs / commandline / cmdlinehelpwriter.cpp
index e3d404a186f00600e427edc24ecb87eeaefdfb38..36e66b9119de4792f10a8eb778b434472cc76d85 100644 (file)
@@ -46,6 +46,7 @@
 #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"
@@ -510,6 +511,12 @@ CommandLineHelpWriter &CommandLineHelpWriter::setTimeUnitString(const char *time
 
 void CommandLineHelpWriter::writeHelp(const CommandLineHelpContext &context)
 {
+    if (context.isCompletionExport())
+    {
+        context.shellCompletionWriter().writeModuleCompletions(
+                context.moduleDisplayName(), impl_->options_);
+        return;
+    }
     const HelpWriterContext &writerContext = context.writerContext();
     const bool               bConsole
         = (writerContext.outputFormat() == eHelpOutputFormat_Console);