From 97428397a5df239d07b48658b2be054fac58500e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 10 Nov 2014 22:07:02 -0500 Subject: [PATCH] CLI/Context - Removed repeated header calls that display a reconstructed command line in the event that default.command is used. --- src/CLI.cpp | 19 ------------------- src/Context.cpp | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index f45236520..b5146b61a 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -1799,9 +1799,6 @@ void CLI::injectDefaults () std::string defaultCommand = context.config.get ("default.command"); if (defaultCommand != "") { - if (context.config.getBoolean ("debug")) - context.debug (std::string ("No command or sequence found - assuming default.command '") + defaultCommand + "'."); - // Split the defaultCommand into separate args. std::vector tokens; Lexer::token_split (tokens, defaultCommand); @@ -1825,18 +1822,6 @@ void CLI::injectDefaults () } _args = reconstructed; - - // Extract a recomposed command line. - std::string combined; - for (a = _args.begin (); a != _args.end (); ++a) - { - if (combined.length ()) - combined += ' '; - - combined += a->attribute ("raw"); - } - - context.header ("[" + combined + "]"); } // Only an error in strict mode. @@ -1847,10 +1832,6 @@ void CLI::injectDefaults () } else { - if (context.config.getBoolean ("debug")) - context.debug ("Sequence but no command found - assuming 'information' command."); - context.header (STRING_ASSUME_INFO); - A info ("argDefault", "information"); info.tag ("ASSUMED"); _args.push_back (info); diff --git a/src/Context.cpp b/src/Context.cpp index 0e29f0b00..9d10119f4 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -245,6 +245,24 @@ int Context::initialize (int argc, const char** argv) cli.initialize (argc, argv); cli.analyze (true, true); + // Extract a recomposed command line. + bool foundDefault = false; + std::string combined; + std::vector ::const_iterator a; + for (a = cli._args.begin (); a != cli._args.end (); ++a) + { + if (combined.length ()) + combined += ' '; + + combined += a->attribute ("raw"); + + if (a->hasTag ("DEFAULT")) + foundDefault = true; + } + + if (foundDefault) + header ("[" + combined + "]"); + //////////////////////////////////////////////////////////////////////////// // // [8] Run on.launch hooks.