Unit Tests, Documentation
- Added 'ids' command to task.1.in. - Added unit test for 'ids' command. - Reformatted 'help' output for the ~ modifier.
This commit is contained in:
@@ -197,6 +197,17 @@ currently defined colors.
|
|||||||
.B count [filter]
|
.B count [filter]
|
||||||
Displays only a count of tasks matching the filter.
|
Displays only a count of tasks matching the filter.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B ids [filter]
|
||||||
|
Applies the filter then extracts only the task IDs and presents them as
|
||||||
|
a range, for example: 1-4,12. This is useful as input to a task command,
|
||||||
|
to achieve this:
|
||||||
|
|
||||||
|
task priority:H $(task ids project:Home)
|
||||||
|
|
||||||
|
This example first gets the IDs for the project:Home filter, then sets
|
||||||
|
the priority to H for each of those tasks.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B version
|
.B version
|
||||||
Shows the taskwarrior version number
|
Shows the taskwarrior version number
|
||||||
|
|||||||
@@ -346,12 +346,12 @@ int longUsage (std::string& outs)
|
|||||||
<< " word" << "\n"
|
<< " word" << "\n"
|
||||||
<< " noword" << "\n"
|
<< " noword" << "\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< "Modifiers can be inverted with the ~ character:" << "\n"
|
|
||||||
<< " project.~is is equivalent to project.isnt" << "\n"
|
|
||||||
<< "\n"
|
|
||||||
<< " For example:" << "\n"
|
<< " For example:" << "\n"
|
||||||
<< " task list due.before:eom priority.not:L" << "\n"
|
<< " task list due.before:eom priority.not:L" << "\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
|
<< " Modifiers can be inverted with the ~ character:" << "\n"
|
||||||
|
<< " project.~is is equivalent to project.isnt" << "\n"
|
||||||
|
<< "\n"
|
||||||
<< "The default .taskrc file can be overridden with:" << "\n"
|
<< "The default .taskrc file can be overridden with:" << "\n"
|
||||||
<< " task rc:<alternate file> ..." << "\n"
|
<< " task rc:<alternate file> ..." << "\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
|
|||||||
72
test/ids.t
Executable file
72
test/ids.t
Executable file
@@ -0,0 +1,72 @@
|
|||||||
|
#! /usr/bin/perl
|
||||||
|
################################################################################
|
||||||
|
## taskwarrior - a command line task list manager.
|
||||||
|
##
|
||||||
|
## Copyright 2010 - 2011, Paul Beckingham, Federico Hernandez.
|
||||||
|
## All rights reserved.
|
||||||
|
##
|
||||||
|
## This program is free software; you can redistribute it and/or modify it under
|
||||||
|
## the terms of the GNU General Public License as published by the Free Software
|
||||||
|
## Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
## version.
|
||||||
|
##
|
||||||
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
## details.
|
||||||
|
##
|
||||||
|
## You should have received a copy of the GNU General Public License along with
|
||||||
|
## this program; if not, write to the
|
||||||
|
##
|
||||||
|
## Free Software Foundation, Inc.,
|
||||||
|
## 51 Franklin Street, Fifth Floor,
|
||||||
|
## Boston, MA
|
||||||
|
## 02110-1301
|
||||||
|
## USA
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More tests => 8;
|
||||||
|
|
||||||
|
# Create the rc file.
|
||||||
|
if (open my $fh, '>', 'ids.rc')
|
||||||
|
{
|
||||||
|
print $fh "data.location=.\n",
|
||||||
|
"confirmation=off\n";
|
||||||
|
close $fh;
|
||||||
|
ok (-r 'ids.rc', 'Created ids.rc');
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test the count command.
|
||||||
|
qx{../src/task rc:ids.rc add one +A +B};
|
||||||
|
qx{../src/task rc:ids.rc add two +A };
|
||||||
|
qx{../src/task rc:ids.rc add three +A +B};
|
||||||
|
qx{../src/task rc:ids.rc add four };
|
||||||
|
qx{../src/task rc:ids.rc add five +A +B};
|
||||||
|
|
||||||
|
my $output = qx{../src/task rc:ids.rc ids +A};
|
||||||
|
like ($output, qr/^1-3,5$/ms, 'ids +A --> 1-3,5');
|
||||||
|
|
||||||
|
$output = qx{../src/task rc:ids.rc ids +B};
|
||||||
|
like ($output, qr/^1,3,5$/ms, 'ids +B --> 1,3,5');
|
||||||
|
|
||||||
|
$output = qx{../src/task rc:ids.rc ids +A -B};
|
||||||
|
like ($output, qr/^2$/ms, 'ids +A -B --> 2');
|
||||||
|
|
||||||
|
# Cleanup.
|
||||||
|
unlink 'pending.data';
|
||||||
|
ok (!-r 'pending.data', 'Removed pending.data');
|
||||||
|
|
||||||
|
unlink 'completed.data';
|
||||||
|
ok (!-r 'completed.data', 'Removed completed.data');
|
||||||
|
|
||||||
|
unlink 'undo.data';
|
||||||
|
ok (!-r 'undo.data', 'Removed undo.data');
|
||||||
|
|
||||||
|
unlink 'ids.rc';
|
||||||
|
ok (!-r 'ids.rc', 'Removed ids.rc');
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
|
||||||
Reference in New Issue
Block a user