diff --git a/src/T.cpp b/src/T.cpp index 842613c56..b589ba628 100644 --- a/src/T.cpp +++ b/src/T.cpp @@ -37,6 +37,7 @@ T::T () mUUID = uuid (); mStatus = pending; mId = 0; + mSequence.clear (); mTags.clear (); mAttributes.clear (); mDescription = ""; @@ -59,6 +60,7 @@ T::T (const T& other) mStatus = other.mStatus; mUUID = other.mUUID; mId = other.mId; + mSequence = other.mSequence; mDescription = other.mDescription; mTags = other.mTags; mRemoveTags = other.mRemoveTags; @@ -74,6 +76,7 @@ T& T::operator= (const T& other) mStatus = other.mStatus; mUUID = other.mUUID; mId = other.mId; + mSequence = other.mSequence; mDescription = other.mDescription; mTags = other.mTags; mRemoveTags = other.mRemoveTags; @@ -286,6 +289,16 @@ void T::addAnnotation (const std::string& description) mAnnotations[time (NULL)] = sanitized; } +//////////////////////////////////////////////////////////////////////////////// +bool T::inSequence (int id) const +{ + foreach (seq, mSequence) + if (*seq == id) + return true; + + return false; +} + //////////////////////////////////////////////////////////////////////////////// // uuid status [tags] [attributes] [annotations] description // diff --git a/src/T.h b/src/T.h index 5e457aba1..23a219fb9 100644 --- a/src/T.h +++ b/src/T.h @@ -84,6 +84,7 @@ public: void getAnnotations (std::map &) const; void setAnnotations (const std::map &); void addAnnotation (const std::string&); + bool inSequence (int) const; const std::string compose () const; const std::string composeCSV (); diff --git a/src/parse.cpp b/src/parse.cpp index c57762ec9..c5bbfbbea 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -487,17 +487,9 @@ void parse ( std::vector sequence; // An id is the first argument found that contains all digits. - if (lowerCase (command) != "add" && -/* - task.getSequenceCount () == 0 && -*/ + if (lowerCase (command) != "add" && // "add" doesn't require an ID validSequence (arg, sequence)) { -/* - for (?) - task.addSequence (?) -*/ - std::cout << "# look like a sequence" << std::endl; foreach (id, sequence) task.addId (*id); } diff --git a/src/report.cpp b/src/report.cpp index cdf2a6a79..e389190e7 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -265,35 +265,38 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf) std::vector tasks; tdb.allPendingT (tasks); - Table table; - table.setTableWidth (width); - table.setDateFormat (conf.get ("dateformat", "m/d/Y")); - - table.addColumn ("Name"); - table.addColumn ("Value"); - - if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) - { - table.setColumnUnderline (0); - table.setColumnUnderline (1); - } - else - table.setTableDashedUnderline (); - - table.setColumnWidth (0, Table::minimum); - table.setColumnWidth (1, Table::flexible); - - table.setColumnJustification (0, Table::left); - table.setColumnJustification (1, Table::left); - // Find the task. + int count = 0; for (unsigned int i = 0; i < tasks.size (); ++i) { T refTask (tasks[i]); - if (refTask.getId () == task.getId ()) + if (refTask.getId () == task.getId () || + task.inSequence (refTask.getId ())) { - Date now; + ++count; + + Table table; + table.setTableWidth (width); + table.setDateFormat (conf.get ("dateformat", "m/d/Y")); + + table.addColumn ("Name"); + table.addColumn ("Value"); + + if (conf.get ("color", true) || conf.get (std::string ("_forcecolor"), false)) + { + table.setColumnUnderline (0); + table.setColumnUnderline (1); + } + else + table.setTableDashedUnderline (); + + table.setColumnWidth (0, Table::minimum); + table.setColumnWidth (1, Table::flexible); + + table.setColumnJustification (0, Table::left); + table.setColumnJustification (1, Table::left); + Date now; int row = table.addRow (); table.addCell (row, 0, "ID"); @@ -440,14 +443,14 @@ std::string handleInfo (TDB& tdb, T& task, Config& conf) } table.addCell (row, 1, entry + " (" + age + ")"); + + out << optionalBlankLine (conf) + << table.render () + << std::endl; } } - if (table.rowCount ()) - out << optionalBlankLine (conf) - << table.render () - << std::endl; - else + if (! count) out << "No matches." << std::endl; return out.str (); diff --git a/src/task.cpp b/src/task.cpp index e64fc0256..190d86daa 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -227,6 +227,12 @@ static std::string longUsage (Config& conf) std::stringstream out; out << shortUsage (conf) << "ID is the numeric identifier displayed by the 'task list' command." << "\n" + << "You can specify multiple IDs for task commands, and multiple tasks" << "\n" + << "will be affected. To specify multiple IDs make sure you use one" << "\n" + << "of these forms:" << "\n" + << " task delete 1,2,3" << "\n" + << " task info 1-3" << "\n" + << " task pri:H 1,2-5,19" << "\n" << "\n" << "Tags are arbitrary words, any quantity:" << "\n" << " +tag The + means add the tag" << "\n"