- Fixed bug whereby arguments were categorized, then defaults were injected
  but no subsequent categorization occurred.
- Added debug diagnostics for default.command, 'modify' and 'information'
  default processing.
This commit is contained in:
Paul Beckingham
2011-07-31 14:01:41 -04:00
parent ccd32cb7d6
commit a171f6e4ac
2 changed files with 10 additions and 1 deletions

View File

@@ -463,6 +463,7 @@ void A3::inject_defaults ()
std::string defaultCommand = context.config.get ("default.command"); std::string defaultCommand = context.config.get ("default.command");
if (defaultCommand != "") if (defaultCommand != "")
{ {
context.debug ("No command or sequence found - assuming default.command.");
capture_first (defaultCommand); capture_first (defaultCommand);
context.header ("[" + combine () + "]"); context.header ("[" + combine () + "]");
} }
@@ -474,12 +475,14 @@ void A3::inject_defaults ()
// Modify command. // Modify command.
if (found_other) if (found_other)
{ {
context.debug ("Sequence and filter, but no command found - assuming 'modify' command.");
capture_first ("modify"); capture_first ("modify");
} }
// Information command. // Information command.
else else
{ {
context.debug ("Sequence but no command found - assuming 'information' command.");
context.header (STRING_ASSUME_INFO); context.header (STRING_ASSUME_INFO);
capture_first ("information"); capture_first ("information");
} }

View File

@@ -119,11 +119,17 @@ int Context::initialize (int argc, const char** argv)
// Instantiate built-in column objects. // Instantiate built-in column objects.
Column::factory (columns); Column::factory (columns);
// Categorize all arguments one more time. THIS IS NECESSARY. // Categorize all arguments one more time. THIS IS NECESSARY - it helps the
// following inject_defaults method determine whether there needs to be a
// default command assumed.
a3.categorize (); a3.categorize ();
// Handle default command and assumed 'info' command. // Handle default command and assumed 'info' command.
a3.inject_defaults (); a3.inject_defaults ();
// The re-categorization allows all injected arguments to be properly given
// a category.
a3.categorize ();
a3.dump ("Context::initialize"); // TODO Remove. a3.dump ("Context::initialize"); // TODO Remove.
// TODO Instantiate extension command objects. // TODO Instantiate extension command objects.