Improve text writing in help output
commit88577e90fd5ea67aff0a16d014a8b8ca7477c3c4
authorTeemu Murtola <teemu.murtola@gmail.com>
Tue, 22 Dec 2015 20:33:07 +0000 (22 22:33 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 27 Dec 2015 11:49:26 +0000 (27 12:49 +0100)
tree9a6148d47dbf6c2f653819f6fbbe7adb8c73a554
parent436b0977eaa8c25fbe974a7d5767876c842967c1
Improve text writing in help output

- Use new facilities in TextWriter for ensuring consistent line breaks
  in the output, removing the need to carefully track where empty lines
  are written out to produce valid reStructuredText and to not produce
  too many empty lines in console output.  Replace most explicit
  newlines with ensureEmptyLine() and friends.
- Use TextWriter consistently in the help writing, making the caller
  responsible of creating the single writer used for the output.  This
  makes all the output share the same writer (and thus the same state),
  and removes the need to access the underlying stream for the writer.

Change-Id: I9d6a54dbb1dbb64fbd6ac95667d6ed9988288a60
27 files changed:
src/gromacs/commandline/cmdlinehelpcontext.cpp
src/gromacs/commandline/cmdlinehelpcontext.h
src/gromacs/commandline/cmdlinehelpmodule.cpp
src/gromacs/commandline/cmdlinehelpwriter.cpp
src/gromacs/commandline/shellcompletions.cpp
src/gromacs/commandline/shellcompletions.h
src/gromacs/commandline/tests/cmdlinehelpmodule.cpp
src/gromacs/commandline/tests/cmdlinehelpwriter.cpp
src/gromacs/commandline/tests/refdata/CommandLineHelpModuleTest_ExportsHelp.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesDefaultValuesFromVariables.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesHelpText.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesLongFileOptions.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesLongOptions.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesOptionGroups.xml
src/gromacs/commandline/tests/refdata/CommandLineHelpWriterTest_HandlesOptionTypes.xml
src/gromacs/onlinehelp/helptopic.cpp
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/onlinehelp/helpwritercontext.h
src/gromacs/onlinehelp/tests/helpmanager.cpp
src/gromacs/selection/indexutil.cpp
src/gromacs/selection/selectioncollection.cpp
src/gromacs/selection/selhelp.cpp
src/gromacs/trajectoryanalysis/tests/refdata/TrajectoryAnalysisCommandLineRunnerTest_WritesHelp.xml
src/gromacs/utility/textwriter.cpp
src/gromacs/utility/textwriter.h
src/testutils/cmdlinetest.cpp
src/testutils/testinit.cpp