- If the program is renamed 'cal' or 'calendar', or symlinked to
  either 'cal' or 'calendar', then the calendar report is run.
This commit is contained in:
Paul Beckingham 2011-07-08 01:16:05 -04:00
parent e92a7fdf7d
commit 8731bf9ac6
2 changed files with 14 additions and 2 deletions

View file

@ -168,7 +168,7 @@ void Arguments::capture (int argc, const char** argv)
}
////////////////////////////////////////////////////////////////////////////////
// Append a pair with a category of "".
// Append a Triple with a blank category.
void Arguments::capture (const std::string& arg)
{
std::vector <std::string> parts;
@ -185,7 +185,7 @@ void Arguments::capture (const std::string& arg)
}
////////////////////////////////////////////////////////////////////////////////
// Prepend a pair with a category of "".
// Prepend a Triple with a blank category.
void Arguments::capture_first (const std::string& arg)
{
// Break the new argument into parts that comprise a series.
@ -289,6 +289,17 @@ void Arguments::categorize ()
else if (arg == this->begin ())
{
arg->_third = "program"; // TODO Is this a problem for expressions that do not contain a program name?
if (arg->_first == "cal" ||
arg->_first == "calendar" ||
arg->_first.find ("/calendar") == arg->_first.length () - 9 ||
arg->_first.find ("/cal") == arg->_first.length () - 4)
{
arg->_first = "calendar";
arg->_third = "command";
found_command = true;
found_non_sequence = true;
}
}
// command

View file

@ -120,6 +120,7 @@ int Context::initialize (int argc, const char** argv)
Column::factory (columns);
// Categorize all arguments one more time.
// TODO This may not be necessary.
args.categorize ();
// Handle default command and assumed 'info' command.