- 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

@ -6,7 +6,8 @@
# Untracked Features, biggest first.
+ autoconf eliminated.
+ New 'ids' command that returns a filtered set of task ID numbers, instead
of the actual tasks. For advanced pipeline use.
of the actual tasks. Similarly there is a 'uuids' commands. For advanced
pipeline use.
+ Now supplements the command line with data read from standard input, which
allows commands like: echo 'add Pay the bills' | task
+ Corrected sorting to use std::stable_sort instead of std::sort, which is not
@ -38,6 +39,7 @@
+ The configuration variable 'json.array' determines whether 'query' command
output is enclosed by '[...]'.
+ The duration 'm' is now interpreted as 'months', not 'minutes'.
# Tracked Features, sorted by ID.
+ Added feature #278, which provides a more consistent command line grammar.

3
NEWS
View file

@ -2,7 +2,8 @@
New Features in taskwarrior 2.0.0
- New 'ids' command that returns a filtered set of task ID numbers, instead
of the actual tasks. For advanced pipeline use.
of the actual tasks. Similarly, there is a 'uuids' command. For advanced
pipeline use.
- Now supplements the command line with data read from standard input, which
allows commands like: echo 'add Pay the bills' | task
- Attribute modifiers may be prefixed with '~' to return the opposite of a

View file

@ -177,6 +177,17 @@ to achieve this:
This example first gets the IDs for the project:Home filter, then sets
the priority to H for each of those tasks.
.TP
.B task <filter> uuids
Applies the filter then extracts only the task UUIDs and presents them as
a comma-separated list. This is useful as input to a task command, to achieve
this:
task $(task project:Home status:completed uuids) modify status:pending
This example first gets the UUIDs for the project:Home and status:completed
filter, then makes each of those tasks pending again.
.TP
.B task <filter> information
Shows all data and metadata for the specified tasks.

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;

View file

@ -209,6 +209,7 @@
#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_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"