- Implemented simple word substitution aliases. This is not the ultimate form
  which will involve the ability to insert arbitrary constructs.  Later.
This commit is contained in:
Paul Beckingham 2014-06-03 00:10:15 -04:00
parent a470e50ee6
commit 1cd09bc87b
7 changed files with 42 additions and 41 deletions

View file

@ -145,9 +145,8 @@ int Context::initialize (int argc, const char** argv)
createDefaultConfig ();
// Handle Aliases.
loadAliases ();
aliases2.load ();
aliases2.resolve (parser.tree ());
alias.load ();
alias.resolve (parser.tree ());
// Initialize the color rules, if necessary.
if (color ())
@ -669,20 +668,6 @@ void Context::createDefaultConfig ()
config.createDefaultData (data_dir);
}
////////////////////////////////////////////////////////////////////////////////
void Context::loadAliases ()
{
aliases.clear ();
std::vector <std::string> vars;
config.all (vars);
std::vector <std::string>::iterator var;
for (var = vars.begin (); var != vars.end (); ++var)
if (var->substr (0, 6) == "alias.")
aliases[var->substr (6)] = config.get (*var);
}
////////////////////////////////////////////////////////////////////////////////
void Context::decomposeSortField (
const std::string& field,