App-JobLog

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  Class::Autouse: '0'
  Config::Tiny: '0'
  DateTime: '0.66'
  DateTime::TimeZone: '1.30'
  Exporter: '0'
  File::HomeDir: '0'
  File::Path: '2.06'
  File::ReadBackwards: '0'
  FileHandle: '0'
  IO::All: '0'
  Modern::Perl: '0'
  Module::Build: '0.3601'
  Term::ReadKey: '2.30'
  Text::Wrap: '0'
  Text::WrapI18N: '0'
  autouse: '0'
  base: '0'
  constant: '0'
  if: '0'
  overload: '0'
  parent: '0'

Makefile.PL  view on Meta::CPAN

    "Class::Autouse" => 0,
    "Config::Tiny" => 0,
    "DateTime" => "0.66",
    "DateTime::TimeZone" => "1.30",
    "Exporter" => 0,
    "File::HomeDir" => 0,
    "File::Path" => "2.06",
    "File::ReadBackwards" => 0,
    "FileHandle" => 0,
    "IO::All" => 0,
    "Modern::Perl" => 0,
    "Module::Build" => "0.3601",
    "Term::ReadKey" => "2.30",
    "Text::Wrap" => 0,
    "Text::WrapI18N" => 0,
    "autouse" => 0,
    "base" => 0,
    "constant" => 0,
    "if" => 0,
    "overload" => 0,
    "parent" => 0

lib/App/JobLog/Command/add.pm  view on Meta::CPAN

package App::JobLog::Command::add;
$App::JobLog::Command::add::VERSION = '1.042';
# ABSTRACT: log an event

use App::JobLog -command;
use Modern::Perl;
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
use autouse 'App::JobLog::Time'         => qw(now);
use Class::Autouse qw(App::JobLog::Log);

sub execute {
    my ( $self, $opt, $args ) = @_;
    my $tags = $opt->tag;
    unless ($tags) {
        $tags = [] if $opt->clear_tags;
    }

lib/App/JobLog/Command/configure.pm  view on Meta::CPAN

package App::JobLog::Command::configure;
$App::JobLog::Command::configure::VERSION = '1.042';
# ABSTRACT: examine or modify App::JobLog configuration

use App::JobLog -command;
use Modern::Perl;
use App::JobLog::Config qw(
  day_length
  editor
  hidden_columns
  merge
  pay_period_length
  precision
  start_pay_period
  sunday_begins_week
  time_zone

lib/App/JobLog/Command/done.pm  view on Meta::CPAN

package App::JobLog::Command::done;
$App::JobLog::Command::done::VERSION = '1.042';
# ABSTRACT: close last open event

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse 'App::JobLog::Log';

sub execute {
    my ( $self, $opt, $args ) = @_;
    $self->simple_command_check($args);

    my $log = App::JobLog::Log->new;
    my ($last) = $log->last_event;
    if ( $last && $last->is_open ) {
        $log->append_event( done => 1 );

lib/App/JobLog/Command/edit.pm  view on Meta::CPAN

package App::JobLog::Command::edit;
$App::JobLog::Command::edit::VERSION = '1.042';
# ABSTRACT: edit the log

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw{
  App::JobLog::Log
  App::JobLog::Log::Line
  Digest::MD5
  FileHandle
};
use autouse 'File::Temp'                => qw(tempfile);
use autouse 'File::Copy'                => qw(copy);
use autouse 'App::JobLog::Config'       => qw(editor log);
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);

lib/App/JobLog/Command/info.pm  view on Meta::CPAN

$App::JobLog::Command::info::VERSION = '1.042';
# ABSTRACT: provides general App::JobLog information

use App::JobLog -command;
use autouse 'File::Temp'          => qw(tempfile);
use autouse 'Pod::Usage'          => qw(pod2usage);
use autouse 'Carp'                => qw(carp);
use autouse 'App::JobLog::Config' => qw(log DIRECTORY);
use Class::Autouse qw(Config File::Spec);

use Modern::Perl;
no if $] >= 5.018, warnings => "experimental::smartmatch";

# using quasi-pod -- == instead of = -- to make this work with Pod::Weaver

sub execute {
    my ( $self, $opt, $args ) = @_;
    $self->simple_command_check($args);
    my ( $fh, $fn ) = tempfile( UNLINK => 1 );
    my ($executable) = reverse File::Spec->splitpath($0);
    my $text;

lib/App/JobLog/Command/last.pm  view on Meta::CPAN

package App::JobLog::Command::last;
$App::JobLog::Command::last::VERSION = '1.042';
# ABSTRACT: show details of last recorded event

use Modern::Perl;
use App::JobLog -command;
use Class::Autouse qw(
  App::JobLog::Log
  App::JobLog::Command::summary
);

sub execute {
   my ( $self, $opt, $args ) = @_;

   # construct event test

lib/App/JobLog/Command/modify.pm  view on Meta::CPAN

package App::JobLog::Command::modify;
$App::JobLog::Command::modify::VERSION = '1.042';
# ABSTRACT: modify last logged event

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw(App::JobLog::Log);
no if $] >= 5.018, warnings => "experimental::smartmatch";

sub execute {
    my ( $self, $opt, $args ) = @_;

    my $log = App::JobLog::Log->new;
    my ( $e, $i ) = $log->last_event;
    $self->usage_error('empty log') unless $e;
    my $ll = $e->data;

lib/App/JobLog/Command/note.pm  view on Meta::CPAN

package App::JobLog::Command::note;
$App::JobLog::Command::note::VERSION = '1.042';
# ABSTRACT: take a note

use App::JobLog -command;
use Modern::Perl;
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
use Class::Autouse qw(App::JobLog::Log);

sub execute {
    my ( $self, $opt, $args ) = @_;
    my $tags = $opt->tag;
    my $log  = App::JobLog::Log->new;
    unless ( $tags || $opt->clear_tags ) {
        my ($last) = $log->last_note;
        $tags = $last->tags if $last;

lib/App/JobLog/Command/parse.pm  view on Meta::CPAN

package App::JobLog::Command::parse;
$App::JobLog::Command::parse::VERSION = '1.042';
# ABSTRACT: parse a time expression

use App::JobLog -command;
use autouse 'App::JobLog::TimeGrammar' => qw(parse);

use Modern::Perl;

sub execute {
    my ( $self, $opt, $args ) = @_;
    my $expression = join ' ', @$args;
    eval {
        my ( $s, $e, $is_interval ) = parse $expression;
        say <<END;
        
received:          $expression
start time:        $s

lib/App/JobLog/Command/resume.pm  view on Meta::CPAN

package App::JobLog::Command::resume;
$App::JobLog::Command::resume::VERSION = '1.042';
# ABSTRACT: resume last closed task

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse 'App::JobLog::Log';
use autouse 'App::JobLog::Time' => qw(now);

sub execute {
   my ( $self, $opt, $args ) = @_;

   # construct event test
   my %must   = map { $_ => 1 } @{ $opt->tag     || [] };
   my %mustnt = map { $_ => 1 } @{ $opt->without || [] };
   my $test   = sub {

lib/App/JobLog/Command/summary.pm  view on Meta::CPAN

package App::JobLog::Command::summary;
$App::JobLog::Command::summary::VERSION = '1.042';
# ABSTRACT: show what you did during a particular period

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw(
  App::JobLog::Log
  App::JobLog::Log::Day
);
use autouse 'App::JobLog::TimeGrammar'  => qw(parse daytime);
use autouse 'Carp'                      => qw(carp);
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
use autouse 'App::JobLog::Config'       => qw(
  columns
  is_hidden

lib/App/JobLog/Command/tags.pm  view on Meta::CPAN

package App::JobLog::Command::tags;
$App::JobLog::Command::tags::VERSION = '1.042';
# ABSTRACT: show what tags you have used

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw(App::JobLog::Log);
use autouse 'App::JobLog::TimeGrammar'  => qw(parse);
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);

sub execute {
    my ( $self, $opt, $args ) = @_;

    my $events = [];
    eval {
        if (@$args)

lib/App/JobLog/Command/today.pm  view on Meta::CPAN

package App::JobLog::Command::today;
$App::JobLog::Command::today::VERSION = '1.042';
# ABSTRACT: show what has happened today

use App::JobLog -command;
use Modern::Perl;
use App::JobLog::Command::summary;
use autouse 'App::JobLog::Time' => qw(now);

use constant FORMAT => '%l:%M:%S %p on %A, %B %d, %Y';

sub execute {
    my ( $self, $opt, $args ) = @_;
    $self->simple_command_check($args);

    # display everything done today

lib/App/JobLog/Command/truncate.pm  view on Meta::CPAN



use App::JobLog -command;
use autouse 'App::JobLog::TimeGrammar' => qw(parse);
use Class::Autouse
  qw(IO::File App::JobLog::Log App::JobLog::Log::Line File::Temp File::Spec);
use autouse 'App::JobLog::Time'   => qw(now);
use autouse 'App::JobLog::Config' => qw(log dir);
use autouse 'File::Copy'          => qw(move);

use Modern::Perl;
no if $] >= 5.018, warnings => "experimental::smartmatch";

sub execute {
    my ( $self, $opt, $args ) = @_;
    my $expression = join ' ', @$args;
    my ( $s, $is_interval );
    eval { ( $s, undef, $is_interval ) = parse $expression; };
    $self->usage_error($@) if $@;
    $self->usage_error('truncation date must not be a interval')
      if $is_interval;

lib/App/JobLog/Command/vacation.pm  view on Meta::CPAN

package App::JobLog::Command::vacation;
$App::JobLog::Command::vacation::VERSION = '1.042';
# ABSTRACT: controller for vacation dates

use Modern::Perl;
use App::JobLog -command;
use autouse 'App::JobLog::TimeGrammar'      => qw(parse);
use autouse 'App::JobLog::Vacation::Period' => qw(
  FLEX
  FIXED
  ANNUAL
  MONTHLY
);
use Class::Autouse qw(App::JobLog::Vacation);
no if $] >= 5.018, warnings => "experimental::smartmatch";

lib/App/JobLog/Command/when.pm  view on Meta::CPAN

package App::JobLog::Command::when;
$App::JobLog::Command::when::VERSION = '1.042';
# ABSTRACT: when you'll be done for the day

use App::JobLog -command;
use Modern::Perl;
use Class::Autouse qw(
  App::JobLog::Log
  App::JobLog::Log::Day
);
use autouse 'App::JobLog::TimeGrammar'  => qw(parse daytime);
use autouse 'Carp'                      => qw(carp);
use autouse 'Getopt::Long::Descriptive' => qw(prog_name);
use autouse 'App::JobLog::Config'       => qw(
  columns
  is_hidden

lib/App/JobLog/Config.pm  view on Meta::CPAN

use Class::Autouse qw{
  File::HomeDir
  File::Spec
  Config::Tiny
  FileHandle
  App::JobLog::Command::info
};
use autouse 'File::Path'    => qw(mkpath);
use autouse 'Cwd'           => qw(abs_path);
use autouse 'Term::ReadKey' => qw(GetTerminalSize);
use Modern::Perl;

# default precision
use constant PRECISION => 2;

# default pay period
use constant PERIOD => 14;

# hours worked in day
use constant HOURS => 8;

lib/App/JobLog/Log.pm  view on Meta::CPAN

package App::JobLog::Log;
$App::JobLog::Log::VERSION = '1.042';
# ABSTRACT: the code that lets us interact with the log


use Modern::Perl;
use App::JobLog::Config qw(log init_file);
use App::JobLog::Log::Line;
use IO::All -utf8;
use autouse 'Carp'              => qw(carp);
use autouse 'App::JobLog::Time' => qw(now);
use Class::Autouse qw(
  App::JobLog::Log::Event
  App::JobLog::Log::Note
  DateTime
  FileHandle

lib/App/JobLog/Log/Day.pm  view on Meta::CPAN

package App::JobLog::Log::Day;
$App::JobLog::Log::Day::VERSION = '1.042';
# ABSTRACT: collects events and vacation in a complete day


use Modern::Perl;
use App::JobLog::Config qw(
  day_length
  is_workday
  precision
);
use Carp qw(carp);
use Text::Wrap;
use App::JobLog::Log::Format qw(
  duration
  wrap

lib/App/JobLog/Log/Event.pm  view on Meta::CPAN

package App::JobLog::Log::Event;
$App::JobLog::Log::Event::VERSION = '1.042';
# ABSTRACT: basically adds an end time to App::JobLog::Log::Line events


use parent qw(App::JobLog::Log::Note);

use Modern::Perl;
use Class::Autouse qw{DateTime};
use autouse 'App::JobLog::Time' => qw(now);
use autouse 'Carp'              => qw(carp);

# for debugging
use overload '""' => sub {
   $_[0]->data->to_string . '-->'
     . ( $_[0]->is_closed ? $_[0]->end : 'ongoing' );
};

lib/App/JobLog/Log/Format.pm  view on Meta::CPAN


use Exporter 'import';
our @EXPORT_OK = qw(
  display
  duration
  single_interval
  summary
  wrap
);

use Modern::Perl;
use App::JobLog::Config qw(
  day_length
  is_workday
  precision
);
use App::JobLog::Log::Synopsis qw(collect :merge);
use Text::WrapI18N qw();
use App::JobLog::TimeGrammar qw(parse);

use constant TAG_COLUMN_LIMIT => 10;

lib/App/JobLog/Log/Line.pm  view on Meta::CPAN

package App::JobLog::Log::Line;
$App::JobLog::Log::Line::VERSION = '1.042';
# ABSTRACT: encapsulates one line of log text


use Modern::Perl;
use Class::Autouse qw{DateTime};
use autouse 'App::JobLog::Time' => qw(now tz);

# represents a single non-comment line in the log
# not using Moose to keep CLI snappy

# to_string method for convenience
use overload '""' => \&to_string;
use overload 'bool' => sub { 1 };

lib/App/JobLog/Log/Note.pm  view on Meta::CPAN

package App::JobLog::Log::Note;
$App::JobLog::Log::Note::VERSION = '1.042';
# ABSTRACT: timestamped annotation in log


use Modern::Perl;
use Class::Autouse qw{DateTime};
use autouse 'App::JobLog::Time' => qw(now);
use autouse 'Carp'              => qw(carp);

# for debugging
use overload '""' => sub {
   $_[0]->data->to_string;
};
use overload 'bool' => sub { 1 };

lib/App/JobLog/Log/Synopsis.pm  view on Meta::CPAN

          MERGE_ADJACENT
          MERGE_ADJACENT_SAME_TAGS
          MERGE_SAME_TAGS
          MERGE_SAME_DAY
          MERGE_SAME_DAY_SAME_TAGS
          MERGE_NONE
          )
    ]
);

use Modern::Perl;
use autouse 'Carp'              => qw(carp);
use autouse 'App::JobLog::Time' => qw(now);
use Class::Autouse qw(DateTime);
no if $] >= 5.018, warnings => "experimental::smartmatch";

use constant MERGE_ALL                => 1;
use constant MERGE_ADJACENT           => 2;
use constant MERGE_ADJACENT_SAME_TAGS => 3;
use constant MERGE_SAME_TAGS          => 4;
use constant MERGE_SAME_DAY           => 5;

lib/App/JobLog/Time.pm  view on Meta::CPAN

# ABSTRACT: consolidates basic time functions into one location


use Exporter 'import';
our @EXPORT_OK = qw(
  now
  today
  tz
);

use Modern::Perl;
use DateTime;
use DateTime::TimeZone;
use App::JobLog::Config qw(_tz);

# cached values
our ( $today, $now );


sub now {
    $now //= DateTime->now( time_zone => tz() );

lib/App/JobLog/TimeGrammar.pm  view on Meta::CPAN

$App::JobLog::TimeGrammar::VERSION = '1.042';
# ABSTRACT: parse natural (English) language time expressions


use Exporter 'import';
our @EXPORT = qw(
  parse
  daytime
);

use Modern::Perl;
use DateTime;
use Class::Autouse qw(
  App::JobLog::Log
);
use Carp 'croak';
use autouse 'App::JobLog::Config' => qw(
  log
  sunday_begins_week
  pay_period_length
  start_pay_period

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.390 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )