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:
committed by
Paul Beckingham
parent
82a4607ec6
commit
fe954a6acc
@@ -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;
|
||||
|
||||
@@ -220,7 +220,9 @@
|
||||
#define STRING_CMD_IDS_USAGE_RANGE "Shows the IDs of matching tasks, as a range"
|
||||
#define STRING_CMD_IDS_USAGE_LIST "Shows only the IDs of matching tasks, in the form of a list"
|
||||
#define STRING_CMD_IDS_USAGE_ZSH "Shows the IDs and descriptions of matching tasks"
|
||||
#define STRING_CMD_UUIDS_USAGE "Shows the UUIDs of matching tasks"
|
||||
#define STRING_CMD_UUIDS_USAGE_RANGE "Shows the UUIDs of matching tasks, as a comma-separated list"
|
||||
#define STRING_CMD_UUIDS_USAGE_LIST "Shows the UUIDs of matching tasks, as a list"
|
||||
#define STRING_CMD_UUIDS_USAGE_ZSH "Shows the UUIDs and descriptions of matching tasks"
|
||||
#define STRING_CMD_EXPORT_USAGE "Exports tasks in JSON format"
|
||||
#define STRING_CMD_INFO_USAGE "Shows all data and metadata"
|
||||
#define STRING_CMD_INFO_BLOCKED "This task blocked by"
|
||||
|
||||
Reference in New Issue
Block a user