Rewrite help output from Options
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 17 Oct 2013 03:18:47 +0000 (06:18 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 20 Jan 2014 17:45:12 +0000 (18:45 +0100)
commitd84127aac1f065195fcd01a7892f49ca3ac8e6ca
tree1023855b8c6ca29a6d0a7b8c45595c1621012ea5
parent699f7c6eb18dc8a25cfc324e8e2520f5a2bad143
Rewrite help output from Options

(Partially) rewrite the way command-line help is printed for an Options
object.  Now man pages and HTML output are supported in addition to
console output.  The console output is formatted in a simpler manner,
since there is no longer any need to cater for user-provided values in
the output.  There is some extra machinery now in cmdlinehelpwriter.cpp,
but left it there as it may still be useful in the future, and it does
structure the code a bit more cleanly.

As an extra bonus, the commandline module should no longer depend on the
selection module.

Things more or less work, but the following could still be addressed,
either in this change or later:
 - Re-add selection option help formatting tests somewhere else.
 - Add unit tests for various things about non-console help formatting.
 - Refactor the way the help information is fetched from OptionInfo
   objects: it would be cleaner to have a single method that returns all
   the information in a struct, instead of multiple virtual methods that
   return different pieces of information, many of which are not
   required for anything else except the help output.
 - Add proper synopsis that lists all the options.

Part of #969.

Change-Id: Iadf1b5df15f278547d5db6407f3e3c689fb88645
30 files changed:
src/gromacs/commandline/CMakeLists.txt
src/gromacs/commandline/cmdlinehelpwriter.cpp
src/gromacs/commandline/tests/cmdlinehelpwriter.cpp
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesLongFileOptions.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesLongOptions.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesMultipleSections.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesOptionTypes.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesSelectionOptions.xml [deleted file]
src/gromacs/onlinehelp/helpformat.cpp
src/gromacs/onlinehelp/helpformat.h
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/onlinehelp/helpwritercontext.h
src/gromacs/onlinehelp/tests/helpformat.cpp
src/gromacs/onlinehelp/tests/refdata/TextTableFormatterTest_HandlesLastColumnFolding.xml [new file with mode: 0644]
src/gromacs/onlinehelp/tests/refdata/TextTableFormatterTest_HandlesOverflowingLines.xml
src/gromacs/options/abstractoption.cpp
src/gromacs/options/abstractoption.h
src/gromacs/options/abstractoptionstorage.h
src/gromacs/options/basicoptions.cpp
src/gromacs/options/basicoptionstorage.h
src/gromacs/options/filenameoption.cpp
src/gromacs/options/filenameoptionstorage.h
src/gromacs/options/optionstoragetemplate.h
src/gromacs/options/tests/abstractoptionstorage.cpp
src/gromacs/selection/selectionfileoptionstorage.h
src/gromacs/selection/selectionoptionstorage.h
src/gromacs/trajectoryanalysis/cmdlinerunner.cpp
src/gromacs/trajectoryanalysis/modules/angle.cpp
src/gromacs/trajectoryanalysis/modules/freevolume.cpp
src/gromacs/trajectoryanalysis/runnercommon.cpp