mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-01 11:20:19 +02:00
Enhancement
- Similar subcommands for 'uuids' as there is for 'ids' ('_uuids' and '_zshuuids'). - Extends the scope and the precision of the unit tests for ids. - Corresponding documentation in the man pages.
This commit is contained in:
parent
82a4607ec6
commit
fe954a6acc
7 changed files with 110 additions and 6 deletions
|
@ -143,7 +143,7 @@ CmdUUIDs::CmdUUIDs ()
|
|||
{
|
||||
_keyword = "uuids";
|
||||
_usage = "task <filter> uuids";
|
||||
_description = STRING_CMD_UUIDS_USAGE;
|
||||
_description = STRING_CMD_UUIDS_USAGE_RANGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
@ -168,3 +168,63 @@ int CmdUUIDs::execute (std::string& output)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdCompletionUuids::CmdCompletionUuids ()
|
||||
{
|
||||
_keyword = "_uuids";
|
||||
_usage = "task <filter> _uuids";
|
||||
_description = STRING_CMD_UUIDS_USAGE_LIST;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdCompletionUuids::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, "\n", uuids);
|
||||
output += "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdZshCompletionUuids::CmdZshCompletionUuids ()
|
||||
{
|
||||
_keyword = "_zshuuids";
|
||||
_usage = "task <filter> _zshuuids";
|
||||
_description = STRING_CMD_UUIDS_USAGE_ZSH;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdZshCompletionUuids::execute (std::string& output)
|
||||
{
|
||||
// Apply filter.
|
||||
handleRecurrence ();
|
||||
std::vector <Task> filtered;
|
||||
filter (filtered);
|
||||
context.tdb2.commit ();
|
||||
|
||||
std::stringstream out;
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
out << task->get ("uuid")
|
||||
<< ":"
|
||||
<< task->get ("description")
|
||||
<< "\n";
|
||||
|
||||
output = out.str ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -60,5 +60,19 @@ public:
|
|||
int execute (std::string&);
|
||||
};
|
||||
|
||||
class CmdCompletionUuids : public Command
|
||||
{
|
||||
public:
|
||||
CmdCompletionUuids ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
class CmdZshCompletionUuids : public Command
|
||||
{
|
||||
public:
|
||||
CmdZshCompletionUuids ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -114,6 +114,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
c = new CmdCompletionCommands (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionConfig (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionIds (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionUuids (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionProjects (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionTags (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionVersion (); all[c->keyword ()] = c;
|
||||
|
@ -162,6 +163,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
|||
c = new CmdVersion (); all[c->keyword ()] = c;
|
||||
c = new CmdZshCommands (); all[c->keyword ()] = c;
|
||||
c = new CmdZshCompletionIds (); all[c->keyword ()] = c;
|
||||
c = new CmdZshCompletionUuids (); all[c->keyword ()] = c;
|
||||
|
||||
// Instantiate a command object for each custom report.
|
||||
std::vector <std::string> variables;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue