mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #956
- Prevent any verbose information to be printed with the 'ids', 'uuids' and helper subcommands. - Unit tests. - Precise this behavior in the man pages.
This commit is contained in:
parent
fe954a6acc
commit
0b1b677aa5
5 changed files with 92 additions and 3 deletions
|
@ -62,6 +62,8 @@ Bugs
|
||||||
have no bearing on a Zulu time.
|
have no bearing on a Zulu time.
|
||||||
+ Fixed man page typos.
|
+ Fixed man page typos.
|
||||||
+ Fixed incorrect Lua API return value (thanks to Oleksii Tsai).
|
+ Fixed incorrect Lua API return value (thanks to Oleksii Tsai).
|
||||||
|
+ Fixed bug #956, which prevents 'ids', 'uuids' and helper commands to be used
|
||||||
|
directly by external script when a variable is override.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,8 @@ Taskwarrior supports different kinds of commands. There are read commands,
|
||||||
write commands, miscellaneous commands and script helper commands. Read
|
write commands, miscellaneous commands and script helper commands. Read
|
||||||
commands do not allow modification of tasks. Write commands can alter almost
|
commands do not allow modification of tasks. Write commands can alter almost
|
||||||
any aspect of a task. Script helper commands are provided to help you write
|
any aspect of a task. Script helper commands are provided to help you write
|
||||||
add-on scripts, for example, shell completion.
|
add-on scripts, for example, shell completion (only minimal output is
|
||||||
|
generated, as with verbose=nothing).
|
||||||
|
|
||||||
.SH READ SUBCOMMANDS
|
.SH READ SUBCOMMANDS
|
||||||
|
|
||||||
|
@ -206,7 +207,8 @@ the priority to H for each of those tasks. This can also be achieved directly:
|
||||||
|
|
||||||
task project:Home modify priority:H
|
task project:Home modify priority:H
|
||||||
|
|
||||||
This command is mainly of use to external scripts.
|
This command is mainly of use to external scripts. As such, only minimal output
|
||||||
|
is generated (equivalent to verbose=nothing).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B task <filter> uuids
|
.B task <filter> uuids
|
||||||
|
@ -219,7 +221,8 @@ this:
|
||||||
This example first gets the UUIDs for the project:Home and status:completed
|
This example first gets the UUIDs for the project:Home and status:completed
|
||||||
filter, then makes each of those tasks pending again.
|
filter, then makes each of those tasks pending again.
|
||||||
|
|
||||||
This command is mainly of use to external scripts.
|
This command is mainly of use to external scripts. As such, only minimal
|
||||||
|
output is generated (equivalent to verbose=nothing).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B task <filter> information
|
.B task <filter> information
|
||||||
|
|
|
@ -365,6 +365,8 @@ int Context::dispatch (std::string &out)
|
||||||
{
|
{
|
||||||
updateXtermTitle ();
|
updateXtermTitle ();
|
||||||
|
|
||||||
|
updateVerbosity ();
|
||||||
|
|
||||||
Command* c = commands[command];
|
Command* c = commands[command];
|
||||||
|
|
||||||
// GC is invoked prior to running any command that displays task IDs, if
|
// GC is invoked prior to running any command that displays task IDs, if
|
||||||
|
@ -688,6 +690,23 @@ void Context::updateXtermTitle ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function allows a clean output if the command is a helper subcommand or
|
||||||
|
// a command aimed at being used by an external script.
|
||||||
|
void Context::updateVerbosity ()
|
||||||
|
{
|
||||||
|
std::string command;
|
||||||
|
a3.find_command (command);
|
||||||
|
|
||||||
|
if (command[0] == '_' ||
|
||||||
|
command == "ids" ||
|
||||||
|
command == "uuids")
|
||||||
|
{
|
||||||
|
verbosity.clear ();
|
||||||
|
verbosity.push_back ("nothing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Context::header (const std::string& input)
|
void Context::header (const std::string& input)
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,6 +79,7 @@ private:
|
||||||
void createDefaultConfig ();
|
void createDefaultConfig ();
|
||||||
void loadAliases ();
|
void loadAliases ();
|
||||||
void updateXtermTitle ();
|
void updateXtermTitle ();
|
||||||
|
void updateVerbosity ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string program;
|
std::string program;
|
||||||
|
|
64
test/bug.956.t
Executable file
64
test/bug.956.t
Executable file
|
@ -0,0 +1,64 @@
|
||||||
|
#! /usr/bin/perl
|
||||||
|
################################################################################
|
||||||
|
## taskwarrior - a command line task list manager.
|
||||||
|
##
|
||||||
|
## Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
|
||||||
|
##
|
||||||
|
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
## of this software and associated documentation files (the "Software"), to deal
|
||||||
|
## in the Software without restriction, including without limitation the rights
|
||||||
|
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
## copies of the Software, and to permit persons to whom the Software is
|
||||||
|
## furnished to do so, subject to the following conditions:
|
||||||
|
##
|
||||||
|
## The above copyright notice and this permission notice shall be included
|
||||||
|
## in all copies or substantial portions of the Software.
|
||||||
|
##
|
||||||
|
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
## SOFTWARE.
|
||||||
|
##
|
||||||
|
## http://www.opensource.org/licenses/mit-license.php
|
||||||
|
##
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More tests => 5;
|
||||||
|
|
||||||
|
# Create the rc file.
|
||||||
|
if (open my $fh, '>', 'bug.rc')
|
||||||
|
{
|
||||||
|
print $fh "data.location=.\n";
|
||||||
|
close $fh;
|
||||||
|
ok (-r 'bug.rc', 'Created bug.rc');
|
||||||
|
}
|
||||||
|
|
||||||
|
# Bug 956 - 'task ids' prints the header, which prevents using the command in
|
||||||
|
# external script (it applies also for 'uuids' and helper subcommands).
|
||||||
|
|
||||||
|
qx{../src/task rc:bug.rc add test};
|
||||||
|
|
||||||
|
my $output = qx{TASKRC=bug.rc ../src/task rc:bug.rc ids};
|
||||||
|
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "ids"');
|
||||||
|
|
||||||
|
$output = qx{TASKRC=bug.rc ../src/task uuids};
|
||||||
|
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "uuids"');
|
||||||
|
|
||||||
|
$output = qx{TASKRC=bug.rc ../src/task _ids};
|
||||||
|
unlike ($output, qr/TASKRC/ms, 'The header does not appear with "_ids"');
|
||||||
|
|
||||||
|
### Cleanup.
|
||||||
|
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
|
||||||
|
ok (! -r 'pending.data' &&
|
||||||
|
! -r 'completed.data' &&
|
||||||
|
! -r 'undo.data' &&
|
||||||
|
! -r 'backlog.data' &&
|
||||||
|
! -r 'synch.key' &&
|
||||||
|
! -r 'bug.rc', 'Cleanup');
|
||||||
|
|
||||||
|
exit 0;
|
Loading…
Add table
Add a link
Reference in a new issue