Be less verbose with program options.
authorTeemu Murtola <teemu.murtola@gmail.com>
Fri, 5 Jul 2013 03:33:16 +0000 (06:33 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 20 Jul 2013 16:55:43 +0000 (18:55 +0200)
Don't print the list of program options by default when running the
Gromacs binaries.  The command line printed as part of the startup
header should provide any diagnostic value there is to this output.
Replace the previous -quiet option (that disabled this output) with
a -verbose option that enables this output again.  Left the mostly no-op
-quiet option there (there is still a special case of -quiet -h used by
gmx_tune_pme), because it will get new use shortly.
Removed the hidden -verb option whose value wasn't used.

Related to #1209.

Change-Id: I9730e1eb08a2ee35d26fd603f48e89f561dee50a

cmake/BuildManPages.cmake
src/gromacs/gmxlib/statutil.cpp
src/gromacs/trajectoryanalysis/runnercommon.cpp
src/gromacs/trajectoryanalysis/tests/moduletest.cpp

index 00733298093a43a17bafc2d0a1936d002fd05997..a1fa0e5268bd019e203b9ccd2488a5b7c932e0f9 100644 (file)
@@ -53,7 +53,7 @@ function (gmx_add_man_page EXENAME)
         endif()
         add_custom_command(TARGET ${EXENAME} POST_BUILD 
             #The redirect is a hack to avoid showing copyright. 
-            #Ideally -quiet would also cause programs to not print copyright.
+            #Ideally there would be a -quiet that would skip all output.
             COMMAND ${CMAKE_COMMAND} -DINFILE=${EXENAME}${GMX_BINARY_SUFFIX}.nroff 
                 -DOUTFILE=${MAN1_PATH}/${EXENAME}.1 -DDESC=" - ${DESC}"
                 -DEXENAME="${CMAKE_BINARY_DIR}/bin/${EXENAME}${GMX_BINARY_SUFFIX}"
index 281f969e958aa5a1ccddde0080c41e532db86c0e..9ca20407dbc6a049d83137ebb97321004931fd79 100644 (file)
@@ -494,7 +494,8 @@ void parse_common_args(int *argc, char *argv[], unsigned long Flags,
                        int nbugs, const char **bugs,
                        output_env_t *oenv)
 {
-    gmx_bool    bHelp    = FALSE, bHidden = FALSE, bQuiet = FALSE, bVersion = FALSE;
+    gmx_bool    bHelp    = FALSE, bHidden  = FALSE;
+    gmx_bool    bQuiet   = FALSE, bVerbose = FALSE, bVersion = FALSE;
     const char *manstr[] = {
         NULL, "no", "html", "tex", "nroff", "ascii",
         "completion", "py", "xml", "wiki", NULL
@@ -506,7 +507,7 @@ void parse_common_args(int *argc, char *argv[], unsigned long Flags,
         NULL, "fs", "ps", "ns", "us", "ms", "s",
         NULL
     };
-    int         nicelevel = 0, debug_level = 0, verbose_level = 0;
+    int         nicelevel = 0, debug_level = 0;
     char       *deffnm    = NULL;
     real        tbegin    = 0, tend = 0, tdelta = 0;
     gmx_bool    bView     = FALSE;
@@ -560,8 +561,8 @@ void parse_common_args(int *argc, char *argv[], unsigned long Flags,
           "Print help info and quit" },
         { "-version",  FALSE, etBOOL, {&bVersion},
           "Print version info and quit" },
-        { "-verb",    FALSE,  etINT, {&verbose_level},
-          "HIDDENLevel of verbosity for this program" },
+        { "-verbose",  FALSE, etBOOL, {&bVerbose},
+          "HIDDENShow options during normal run" },
         { "-hidden", FALSE, etBOOL, {&bHidden},
           "HIDDENPrint hidden options" },
         { "-quiet", FALSE, etBOOL, {&bQuiet},
@@ -702,7 +703,7 @@ void parse_common_args(int *argc, char *argv[], unsigned long Flags,
 
     /* set program name, command line, and default values for output options */
     output_env_init(oenv, *argc, argv, (time_unit_t)nenum(time_units), bView,
-                    (xvg_format_t)nenum(xvg_format), verbose_level, debug_level);
+                    (xvg_format_t)nenum(xvg_format), 0, debug_level);
 
     if (bVersion)
     {
@@ -786,14 +787,14 @@ void parse_common_args(int *argc, char *argv[], unsigned long Flags,
 #endif
 #endif
 
-    if (!(FF(PCA_QUIET) || bQuiet ))
+    if (!(FF(PCA_QUIET) || bQuiet))
     {
         if (bHelp)
         {
             write_man(stderr, "help", output_env_get_program_name(*oenv),
                       ndesc, desc, nfile, fnm, npall, all_pa, nbugs, bugs, bHidden);
         }
-        else
+        else if (bVerbose)
         {
             pr_fns(stderr, nfile, fnm);
             print_pargs(stderr, npall, all_pa, FALSE);
index 047bbbc0241d00efc038edab6fdedeb906c6751a..3b2006eb81880d85ce7f4367beaaf6afc4878ff7 100644 (file)
@@ -83,7 +83,7 @@ class TrajectoryAnalysisRunnerCommon::Impl
 
         bool                        bHelp_;
         bool                        bShowHidden_;
-        bool                        bQuiet_;
+        bool                        bVerbose_;
         //! Name of the trajectory file (empty if not provided).
         std::string                 trjfile_;
         //! Name of the topology file (empty if no topology provided).
@@ -107,7 +107,7 @@ class TrajectoryAnalysisRunnerCommon::Impl
 
 TrajectoryAnalysisRunnerCommon::Impl::Impl(TrajectoryAnalysisSettings *settings)
     : settings_(*settings),
-      bHelp_(false), bShowHidden_(false), bQuiet_(false),
+      bHelp_(false), bShowHidden_(false), bVerbose_(false),
       startTime_(0.0), endTime_(0.0), deltaTime_(0.0),
       grps_(NULL),
       bTrajOpen_(false), fr(NULL), gpbc_(NULL), status_(NULL), oenv_(NULL)
@@ -179,9 +179,9 @@ TrajectoryAnalysisRunnerCommon::initOptions(Options *options)
     options->addOption(BooleanOption("hidden").store(&impl_->bShowHidden_)
                            .hidden()
                            .description("Show hidden options"));
-    options->addOption(BooleanOption("quiet").store(&impl_->bQuiet_)
+    options->addOption(BooleanOption("verbose").store(&impl_->bVerbose_)
                            .hidden()
-                           .description("Hide options in normal run"));
+                           .description("Show options during normal run"));
 
     // Add common file name arguments.
     options->addOption(FileNameOption("f")
@@ -453,17 +453,18 @@ TrajectoryAnalysisRunnerCommon::helpFlags() const
 {
     HelpFlags flags = 0;
 
-    if (!impl_->bQuiet_)
+    if (impl_->bVerbose_)
     {
         flags |= efHelpShowOptions;
-        if (impl_->bHelp_)
-        {
-            flags |= efHelpShowDescriptions;
-        }
-        if (impl_->bShowHidden_)
-        {
-            flags |= efHelpShowHidden;
-        }
+    }
+    if (impl_->bHelp_)
+    {
+        flags |= efHelpShowOptions;
+        flags |= efHelpShowDescriptions;
+    }
+    if (flags != 0 && impl_->bShowHidden_)
+    {
+        flags |= efHelpShowHidden;
     }
     return flags;
 }
index 4df3d2f8ca99aacb6e8388c1001f57ea8e288de4..a86ed8c55f7e1fa3dfe542da1b2a75a252e4f590 100644 (file)
@@ -102,7 +102,6 @@ AbstractTrajectoryAnalysisModuleTestFixture::Impl::Impl(
     : parent_(*parent), bDatasetsIncluded_(false)
 {
     cmdline_.append("module");
-    cmdline_.append("-quiet");
 }
 
 TrajectoryAnalysisModule &