- Added a 'uuids' command that parallels the 'ids' command.  This allows
  task UUIDs to be selected if the task is not pending.
- Updated documentation.
This commit is contained in:
Paul Beckingham 2011-10-29 23:53:36 -04:00
parent 01087c0ff4
commit e13ad1bbaf
7 changed files with 55 additions and 3 deletions

View file

@ -25,13 +25,13 @@
//
////////////////////////////////////////////////////////////////////////////////
#define L10N // Localization complete.
#include <sstream>
#include <algorithm>
#include <Context.h>
#include <main.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
#include <CmdIDs.h>
@ -139,3 +139,32 @@ int CmdZshCompletionIds::execute (std::string& output)
}
////////////////////////////////////////////////////////////////////////////////
CmdUUIDs::CmdUUIDs ()
{
_keyword = "uuids";
_usage = "task <filter> uuids";
_description = STRING_CMD_UUIDS_USAGE;
_read_only = true;
_displays_id = false;
}
////////////////////////////////////////////////////////////////////////////////
int CmdUUIDs::execute (std::string& output)
{
// Apply filter.
handleRecurrence ();
std::vector <Task> filtered;
filter (filtered);
context.tdb2.commit ();
std::vector <std::string> uuids;
std::vector <Task>::iterator task;
for (task = filtered.begin (); task != filtered.end (); ++task)
uuids.push_back (task->get ("uuid"));
join (output, ",", uuids);
output += "\n";
return 0;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -53,5 +53,12 @@ public:
int execute (std::string&);
};
class CmdUUIDs : public Command
{
public:
CmdUUIDs ();
int execute (std::string&);
};
#endif
////////////////////////////////////////////////////////////////////////////////

View file

@ -156,6 +156,7 @@ void Command::factory (std::map <std::string, Command*>& all)
c = new CmdTimesheet (); all[c->keyword ()] = c;
c = new CmdUndo (); all[c->keyword ()] = c;
c = new CmdUrgency (); all[c->keyword ()] = c;
c = new CmdUUIDs (); all[c->keyword ()] = c;
c = new CmdVersion (); all[c->keyword ()] = c;
c = new CmdZshCommands (); all[c->keyword ()] = c;
c = new CmdZshCompletionIds (); all[c->keyword ()] = c;