Enhancements

- Fixed word wrapping problem on "help" page.
- Writes errors to std::cout because std::cerr confuses tests.
  Presumably no users will care.  I don't.
- Added listDiff template function.
This commit is contained in:
Paul Beckingham 2009-05-07 00:30:20 -04:00
parent fea19e036a
commit 72ff15ea7a
2 changed files with 51 additions and 4 deletions

View file

@ -226,9 +226,9 @@ static std::string longUsage (Config& conf)
{ {
std::stringstream out; std::stringstream out;
out << shortUsage (conf) out << shortUsage (conf)
<< "ID is the numeric identifier displayed by the 'task list' command." << "\n" << "ID is the numeric identifier displayed by the 'task list' command. "
<< "You can specify multiple IDs for task commands, and multiple tasks" << "\n" << "You can specify multiple IDs for task commands, and multiple tasks "
<< "will be affected. To specify multiple IDs make sure you use one" << "\n" << "will be affected. To specify multiple IDs make sure you use one "
<< "of these forms:" << "\n" << "of these forms:" << "\n"
<< " task delete 1,2,3" << "\n" << " task delete 1,2,3" << "\n"
<< " task info 1-3" << "\n" << " task info 1-3" << "\n"
@ -341,7 +341,7 @@ int main (int argc, char** argv)
catch (std::string& error) catch (std::string& error)
{ {
std::cerr << error << std::endl; std::cout << error << std::endl;
return -1; return -1;
} }

View file

@ -90,8 +90,14 @@ std::string handleUndo (TDB&, T&, Config&);
std::string handleColor (Config&); std::string handleColor (Config&);
std::string handleAnnotate (TDB&, T&, Config&); std::string handleAnnotate (TDB&, T&, Config&);
T findT (int, const std::vector <T>&); T findT (int, const std::vector <T>&);
int deltaAppend (T&, T&);
int deltaDescription (T&, T&);
int deltaTags (T&, T&);
int deltaAttributes (T&, T&);
int deltaSubstitutions (T&, T&);
// report.cpp // report.cpp
void filterSequence (std::vector<T>&, T&);
void filter (std::vector<T>&, T&); void filter (std::vector<T>&, T&);
std::string handleInfo (TDB&, T&, Config&); std::string handleInfo (TDB&, T&, Config&);
std::string handleCompleted (TDB&, T&, Config&); std::string handleCompleted (TDB&, T&, Config&);
@ -151,4 +157,45 @@ void autoColorize (T&, Text::color&, Text::color&, Config&);
// import.cpp // import.cpp
std::string handleImport (TDB&, T&, Config&); std::string handleImport (TDB&, T&, Config&);
// list template
///////////////////////////////////////////////////////////////////////////////
template <class T> void listDiff (
const T& left, const T& right, T& leftOnly, T& rightOnly)
{
leftOnly.clear ();
rightOnly.clear ();
for (unsigned int l = 0; l < left.size (); ++l)
{
bool found = false;
for (unsigned int r = 0; r < right.size (); ++r)
{
if (left[l] == right[r])
{
found = true;
break;
}
}
if (!found)
leftOnly.push_back (left[l]);
}
for (unsigned int r = 0; r < right.size (); ++r)
{
bool found = false;
for (unsigned int l = 0; l < left.size (); ++l)
{
if (left[l] == right[r])
{
found = true;
break;
}
}
if (!found)
rightOnly.push_back (right[r]);
}
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////