#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use Org::Parser;
our $VERSION = '0.21'; # VERSION
my $org = Org::Parser->new;
my $doc;
{
local $/;
$doc = $org->parse(~~<>);
}
my $n = 0;
$doc->walk(
sub {
my $el = shift;
$n++ if $el->isa('Org::Element::Headline') && $el->is_done;
});
say $n;
# ABSTRACT: Count todos which are done in Org document
# PODNAME: count-done-org-todos
__END__
=pod
=encoding UTF-8
=head1 NAME
count-done-org-todos - Count todos which are done in Org document
=head1 VERSION
version 0.21
=head1 SYNOPSIS
% count-done-org-todos todo.org
59
which is equivalent to:
% list-org-todos --done todo.org | wc -l
=head1 SEE ALSO
L<Org::Parser>
L<count-undone-org-todos>
L<count-org-todos>
L<list-org-todos>
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-OrgUtils>.
=head1 SOURCE
Source repository is at L<https://github.com/sharyanto/perl-App-OrgUtils>.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-OrgUtils>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 AUTHOR
Steven Haryanto <stevenharyanto@gmail.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut