App-TimeClock

 view release on metacpan or  search on metacpan

bin/timeclock.pl  view on Meta::CPAN

# non-option argument, if used.
my $timelog;

if ($#ARGV == 1 || $#ARGV == 0 && $ARGV[0] !~ /^--/) {
    $timelog = pop @ARGV;
} else {
    $timelog = $Config::timelog;
}

# The printer to use (this would be an instance of subclass to
# PrinterInterface). Which one to instansiate depends on the command
# line options given.
my $printer;

if ($#ARGV == 0) {
    if ($ARGV[0] eq "--help") {
        pod2usage(-verbose => 1);
    } elsif ($ARGV[0] eq "--man") {
        pod2usage(-verbose => 2);
    } elsif ($ARGV[0] eq "--version") {        
        printf "\nThis is %s version %s\n", basename($0), App::TimeClock->VERSION();
        print "\nCopyright (C) 2012-2015 Søren Lund\n";
        print "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n";
        print "This is free software: you are free to change and redistribute it.\n";
        print "There is NO WARRANTY, to the extent permitted by law.\n";
        print "\nWritten by Søren Lund.\n";

        exit 0;
    } elsif ($ARGV[0] eq "--html") {
        $printer = App::TimeClock::Daily::HtmlPrinter->new();
    } elsif  ($ARGV[0] eq "--csv") {
        $printer = App::TimeClock::Daily::CsvPrinter->new();
    } else {
        print "Unknown option '$ARGV[0]'\n";
        pod2usage(-verbose => 1);
    }
} elsif ($#ARGV == -1) {
    $printer = App::TimeClock::Daily::ConsolePrinter->new();
} else {
    pod2usage(-verbose => 1);
}

# Finally create and execute the daily report.
App::TimeClock::Daily::Report->new($timelog, $printer)->execute();

__END__

=begin html

<p>
    <a href="https://travis-ci.org/soren/App-TimeClock"><img
        src="https://img.shields.io/travis/soren/App-TimeClock.svg"/></a>

    <a href="https://coveralls.io/r/soren/App-TimeClock?branch=master"><img
        src="https://img.shields.io/coveralls/soren/App-TimeClock.svg"/></a>

    <a href="https://readthedocs.org/projects/apptimeclock/?badge=latest"><img
        src="https://readthedocs.org/projects/apptimeclock/badge/?version=latest"/></a>

    <a href="https://metacpan.org/release/App-TimeClock"><img
        src="https://img.shields.io/cpan/v/App-TimeClock.png"/></a>

    <a href="https://www.gnu.org/licenses/gpl.html"><img
        src="https://img.shields.io/github/license/soren/App-TimeClock.png"/></a>

    <a href="http://waffle.io/soren/App-TimeClock"><img
        src="https://badge.waffle.io/soren/App-TimeClock.png?label=ready&title=Ready"/></a>
</p>

=end html

=head1 NAME

timeclock.pl - a timeclock reporting utility

=head1 USAGE

timeclock.pl [options] [file]

Some examples:

    # Console output
    $ timeclock.pl timelog.bak

    # HTML output
    $ timeclock.pl --html > report.html

    # CSV output
    $ timeclock.pl --csv > report.csv

=head1 OPTIONS

Accepts excactly I<one> of the folowing options:

=over

=item B<--help>

Print short usages information and exits.

=item B<--man>

Displays the manual and exits.

=item B<--version>

Displays the version number and copyright information and exits.

=item B<--html>

Switches to HTML formatted output.

=item B<--csv>

Switches to CSV formatted output.

=back

=head1 DESCRIPTION

This is a simple reporting utility for timeclock, which is a time
tracking package for GNU Emacs.

You will use timeclock from GNU Emacs to I<check in> and I<check out>
of projects during your workday.

Then at the end of the week you can run L<timeclock.pl> to get a daily



( run in 2.181 seconds using v1.01-cache-2.11-cpan-df04353d9ac )