App-karr

 view release on metacpan or  search on metacpan

lib/App/karr/Cmd/Archive.pm  view on Meta::CPAN


  $self->check_positional_args($args_ref, 1);

  $self->sync_before;

  my @pos = $self->positional_args($args_ref);
  my $id_str = $pos[0] or die "Usage: karr archive ID[,ID,...]\n";

  my @ids = $self->parse_ids($id_str);
  my @results;
  my $not_found = 0;

  for my $id (@ids) {
    my $task = $self->find_task($id);
    unless ($task) {
      push @results, { id => $id + 0, error => "not found" };
      warn "Task $id not found\n" unless $self->json;
      $not_found++;
      next;
    }

    if ($task->status eq 'archived') {
      push @results, {
        id     => $task->id,
        title  => $task->title,
        status => 'archived',
        note   => 'already archived',
      };

lib/App/karr/Cmd/Archive.pm  view on Meta::CPAN

  }

  $self->sync_after;

  $self->print_json_results(@results);

  # Existing ids are already committed above; a missing id in the batch still
  # makes the whole command report failure via a non-zero exit, matching the
  # die-based not-found behaviour of the other id-taking commands (kanban-md
  # parity: partial success committed, overall exit non-zero).
  exit 1 if $not_found;
}

1;

__END__

=pod

=encoding UTF-8



( run in 1.068 second using v1.01-cache-2.11-cpan-7fcb06a456a )