App-karr
view release on metacpan or search on metacpan
lib/App/karr/Cmd/Handoff.pm view on Meta::CPAN
# ABSTRACT: Hand off a task for review
package App::karr::Cmd::Handoff;
our $VERSION = '0.601';
use Moo;
use MooX::Cmd;
use MooX::Options (
usage_string => 'USAGE: karr handoff ID --claim NAME [--note TEXT] [--block REASON] [--release]',
);
use App::karr::Role::BoardAccess;
use App::karr::Role::Output;
use App::karr::Role::TaskMutation;
use App::karr::Role::ClaimDefault;
use App::karr::Task;
use App::karr::Config;
use App::karr::Error ();
use Time::Piece;
# TaskMutation composes Role::ClaimTimeout, which is where check_claim comes
# from; handoff no longer names it separately because it no longer applies the
# claim rule on its own terms.
with 'App::karr::Role::BoardAccess', 'App::karr::Role::Output',
'App::karr::Role::TaskMutation', 'App::karr::Role::ClaimDefault';
option claim => (
is => 'ro',
format => 's',
doc => 'Agent name claiming the task (defaults to KARR_CLAIM)',
);
option note => (
is => 'ro',
format => 's',
doc => 'Handoff note to append to body',
);
option timestamp => (
is => 'ro',
short => 't',
doc => 'Prefix timestamp to note',
);
option block => (
is => 'ro',
format => 's',
doc => 'Block task with reason',
);
option release => (
is => 'ro',
doc => 'Release claim after handoff',
);
sub execute {
my ($self, $args_ref, $chain_ref) = @_;
$self->check_positional_args($args_ref, 1);
$self->sync_before;
$self->require_board;
my @pos = $self->positional_args($args_ref);
# See the note in Cmd::Move: length, not truth, or the id "0" is read as no
# id at all and answered with a usage error instead of "not found" (#239).
my $id = $pos[0];
# No suggestion line here, deliberately (ticket k263). This guard fires only
# when the id is missing, and --claim is required on this command, so by the
# time it is reached the caller has typed nothing that could be quoted back:
# a suggestion would be `karr handoff ID --claim NAME`, which is the "Usage:"
# line again in placeholders -- the generic example k263 refuses, and the one
# line a `tail -1` would keep. The "Usage:" line is the actionable line here.
die "Usage: karr handoff ID --claim NAME [--note TEXT] [--block REASON] [--release]\n"
unless defined $id && length $id;
# --claim was `required => 1` before ADR 0005; now KARR_CLAIM fills it when the
# flag is omitted. A handoff still needs a claim, so when neither supplies one
# this is a usage error (exit 2, as the old required was) that names both ways.
my $claim = $self->resolved_claim;
( run in 1.617 second using v1.01-cache-2.11-cpan-85d3896f969 )