Argument Parsing

- Eliminated stored arg_overrides and file_override in Context.
- Removed Filter, Subst, Task, Sequence from Context.
- Remove shadow file support.  Hallelujah.
- Disabled/commented out most commands, ready for the big transition
  to the new parsing style.
- Obsoleted Subst.{h,cpp}.
This commit is contained in:
Paul Beckingham
2011-06-04 15:11:34 -04:00
parent b4c1e47ab4
commit 58a677ffb5
42 changed files with 265 additions and 383 deletions

View File

@@ -48,19 +48,12 @@ Context::Context ()
, data_dir ()
, extension_dir ()
, config ()
, filter ()
, sequence ()
, subst ()
, task ()
, tdb ()
, tdb2 ()
, file_override ("")
, var_overrides ("")
, dom ()
, determine_color_use (true)
, use_color (true)
, verbosity_legacy (false)
, inShadow (false)
, terminal_width (0)
, terminal_height (0)
{
@@ -89,7 +82,7 @@ void Context::initialize (int argc, const char** argv)
// Process 'rc:<file>' command line override, and remove the argument from the
// Context::args.
args.rc_override (home_dir, rc_file, file_override);
args.rc_override (home_dir, rc_file);
// Dump any existing values and load rc file.
config.clear ();
@@ -111,7 +104,7 @@ void Context::initialize (int argc, const char** argv)
args.resolve_aliases ();
// Apply rc overrides to Context::config, capturing raw args for later use.
args.apply_overrides (var_overrides);
args.apply_overrides ();
// Initialize the color rules, if necessary.
if (color ())
@@ -356,6 +349,7 @@ void Context::shadow ()
////////////////////////////////////////////////////////////////////////////////
void Context::disallowModification () const
{
/*
if (task.size () ||
subst.mFrom != "" ||
tagAdditions.size () ||
@@ -363,6 +357,7 @@ void Context::disallowModification () const
throw std::string ("The '")
// + cmd.command
+ "' command does not allow further modification of a task.";
*/
}
////////////////////////////////////////////////////////////////////////////////
@@ -412,14 +407,6 @@ void Context::loadAliases ()
aliases[var->substr (6)] = config.get (*var);
}
////////////////////////////////////////////////////////////////////////////////
/*
void Context::parse ()
{
parse (args, cmd, task, sequence, subst, filter);
}
*/
////////////////////////////////////////////////////////////////////////////////
/*
void Context::parse (
@@ -699,23 +686,11 @@ void Context::decomposeSortField (
// be initialized. That makes this method something of a misnomer. So be it.
void Context::clear ()
{
// Config config;
filter.clear ();
sequence.clear ();
subst.clear ();
// task.clear ();
task = Task ();
tdb.clear (); // TODO Obsolete
// tdb2.clear ();
args.clear ();
file_override = "";
var_overrides = "";
// cmd.command = ""; // TODO Obsolete
tagAdditions.clear ();
tagRemovals.clear ();
clearMessages ();
inShadow = false;
}
////////////////////////////////////////////////////////////////////////////////
@@ -804,6 +779,7 @@ void Context::autoFilter (Att& a, Filter& f)
// Add all the tags in the task to the filter.
void Context::autoFilter (Filter& f)
{
/*
// This is now a correct implementation of a filter on the presence or absence
// of a tag. The prior code provided the illusion of leftmost partial tag
// matches, but was really using the 'contains' and 'nocontains' attribute
@@ -822,6 +798,7 @@ void Context::autoFilter (Filter& f)
f.push_back (Att ("tags", "noword", *tag));
debug ("auto filter: -" + *tag);
}
*/
}
////////////////////////////////////////////////////////////////////////////////