App-CalendarDatesUtils

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.010   2019-06-28  Released-By: PERLANCAR

	- No functional changes.

	- Tweak Changes, try out new release note style.


0.009   2019-06-28  Released-By: PERLANCAR

        [Script: list-calendar-dates]

	- Add options --min-year, --max-year.

	- [ux] Add short aliases -Y for --year, -M for --month, -D for --day.

	- [ux] [incompatible change] By default, --all-years only shows dates at
	  most 10 years to the back and future, to avoid showing too many years
	  (e.g. up to year 9999) for anniversaries. User will need to specify
	  --all-entries (-A) to show dates beyond that range.

	- [ux] Add -L option to list all Calendar::Dates::* modules. This is
	  mostly a convenience so we don't have to use the separate script
	  list-calendar-dates-modules.

	- [bugfix] Fix schema for month and day (used 'between' instead of 'in'
	  clause).


0.008   2019-06-26  Released-By: PERLANCAR

	- No functional changes.

	- Udpate Changes.

Changes  view on Meta::CPAN

          commits from previous release.

        - Tweak Rinci metadata.


0.005   2019-05-28  Released-By: PERLANCAR; Status: broken

	- UPDATE 2019-06-26: this release should not be used as it misses some
          commits from previous release.

	- list-calendar-dates: Add option: --(no-)past.


0.004   2019-05-25  Released-By: PERLANCAR; Status: broken

	- UPDATE 2019-06-26: this release should not be used as it misses some
          commits from previous release.

	- list-calendar-dates: Add --param option.


0.003   2019-06-20  Released-By: PERLANCAR

	- list-calendar-dates: Rename --all (-a) to --all-modules (-a), add
	  --all-entries (-A), add --include-tags (-t) & --exclude-tags
	  (-T).


0.002   2019-02-14  Released-By: PERLANCAR

	- list-calendar-dates: allow listing from multiple modules, add
	  --all (-a) to use all installed modules.

	- [ux] list-calendar-dates: Use Perinci::CmdLine::Classic to show
	  nice tables instead of JSON.


0.001   2019-02-13  Released-By: PERLANCAR

        - First release.

MANIFEST  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/App/CalendarDatesUtils.pm
script/list-calendar-dates
script/list-calendar-dates-modules
t/00-compile.t
t/author-critic.t
t/author-pod-coverage.t
t/author-pod-syntax.t
t/release-rinci.t
weaver.ini

META.json  view on Meta::CPAN

      }
   },
   "version" : "0.011",
   "x_Dist_Zilla" : {
      "perl" : {
         "version" : "5.030000"
      },
      "plugins" : [
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript list-calendar-dates-modules",
            "version" : "0.421"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript list-calendar-dates",
            "version" : "0.421"
         },
         {
            "class" : "Dist::Zilla::Plugin::InsertExecsList",
            "name" : "InsertExecsList",
            "version" : "0.02"
         },
         {
            "class" : "Dist::Zilla::Plugin::GatherDir",
            "config" : {

META.yml  view on Meta::CPAN

  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=App-CalendarDatesUtils
  homepage: https://metacpan.org/release/App-CalendarDatesUtils
  repository: git://github.com/perlancar/perl-App-CalendarDatesUtils.git
version: '0.011'
x_Dist_Zilla:
  perl:
    version: '5.030000'
  plugins:
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript list-calendar-dates-modules'
      version: '0.421'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript list-calendar-dates'
      version: '0.421'
    -
      class: Dist::Zilla::Plugin::InsertExecsList
      name: InsertExecsList
      version: '0.02'
    -
      class: Dist::Zilla::Plugin::GatherDir
      config:
        Dist::Zilla::Plugin::GatherDir:
          exclude_filename: []

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Utilities related to Calendar::Dates",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "App-CalendarDatesUtils",
  "EXE_FILES" => [
    "script/list-calendar-dates",
    "script/list-calendar-dates-modules"
  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010001",
  "NAME" => "App::CalendarDatesUtils",
  "PREREQ_PM" => {
    "Data::Sah::Coerce::perl::To_str::From_str::normalize_perl_modname" => 0,
    "Data::Sah::Compiler::perl::TH::array" => 0,
    "Data::Sah::Compiler::perl::TH::bool" => 0,
    "Data::Sah::Compiler::perl::TH::hash" => 0,
    "Data::Sah::Compiler::perl::TH::int" => 0,

README  view on Meta::CPAN

NAME
    App::CalendarDatesUtils - Utilities related to Calendar::Dates

VERSION
    This document describes version 0.011 of App::CalendarDatesUtils (from
    Perl distribution App-CalendarDatesUtils), released on 2019-12-11.

DESCRIPTION
    This distributions provides the following command-line utilities:

    *   list-calendar-dates

    *   list-calendar-dates-modules

FUNCTIONS
  list_calendar_dates
    Usage:

     list_calendar_dates(%args) -> [status, msg, payload, meta]

    List dates from one or more Calendar::Dates::* modules.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   action => *str* (default: "list-dates")

    *   all_entries => *true*

README  view on Meta::CPAN


    First element (status) is an integer containing HTTP status code (200
    means OK, 4xx caller error, 5xx function error). Second element (msg) is
    a string containing error message, or 'OK' if status is 200. Third
    element (payload) is optional, the actual result. Fourth element (meta)
    is called result metadata and is optional, a hash that contains extra
    information.

    Return value: (any)

  list_calendar_dates_modules
    Usage:

     list_calendar_dates_modules() -> [status, msg, payload, meta]

    List Calendar::Dates::* modules, without the prefix.

    This function is not exported.

    No arguments.

    Returns an enveloped result (an array).

    First element (status) is an integer containing HTTP status code (200

dist.ini  view on Meta::CPAN

version=0.011

name=App-CalendarDatesUtils

[GenPericmdScript / GenPericmdScript list-calendar-dates-modules]
url=/App/CalendarDatesUtils/list_calendar_dates_modules
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript list-calendar-dates]
cmdline=Perinci::CmdLine::Classic
url=/App/CalendarDatesUtils/list_calendar_dates
read_config=0
read_env=0
use_utf8=1

[InsertExecsList]

[@Author::PERLANCAR]
:version=0.598

[Prereqs]

lib/App/CalendarDatesUtils.pm  view on Meta::CPAN

our $DATE = '2019-12-11'; # DATE
our $VERSION = '0.011'; # VERSION

use 5.010001;
use strict 'subs', 'vars';
use warnings;
#use Log::ger;

our %SPEC;

$SPEC{list_calendar_dates_modules} = {
    v => 1.1,
    summary => 'List Calendar::Dates::* modules, without the prefix',
};
sub list_calendar_dates_modules {
    require Module::List::Tiny;

    my $mods = Module::List::Tiny::list_modules(
        "Calendar::Dates::", {list_modules=>1, recurse=>1});
    my @res = sort keys %$mods;
    for (@res) { s/\ACalendar::Dates::// }
    [200, "OK" ,\@res];
}

$SPEC{list_calendar_dates} = {
    v => 1.1,
    summary => 'List dates from one or more Calendar::Dates::* modules',
    args => {
        action => {
            schema => ['str*', in=>['list-dates', 'list-modules']],
            default => 'list-dates',
            cmdline_aliases => {
                L => {is_flag=>1, summary=>'List all Calendar::Dates modules (eqv to --action=list-modules)', code=>sub { $_[0]{action} = 'list-modules' }},
            },
        },

lib/App/CalendarDatesUtils.pm  view on Meta::CPAN

        'choose_one&' => [
            ['modules', 'all_modules'],
            ['year', 'all_years'],
            ['year', 'min_year'],
            ['year', 'max_year'],
        ],
        'choose_all&' => [
        ],
    },
};
sub list_calendar_dates {
    my %args = @_; $args{'action'} //= "list-dates";my $arg_err; { no warnings ('void');if (exists($args{'action'})) { ((defined($args{'action'})) ? 1 : (($arg_err //= "Required but not specified"),0)) && ((!ref($args{'action'})) ? 1 : (($arg_err //=...

    my $action = $args{action};
    if ($action eq 'list-modules') {
        return list_calendar_dates_modules();
    }

    my @lt = localtime;
    my $year_today = $lt[5]+1900;
    my $mon_today  = $lt[4]+1;
    my $day_today  = $lt[3];
    #log_trace "date_today: %04d-%02d-%02d", $year_today, $mon_today, $day_today;
    #my $date_today = sprintf "%04d-%02d-%02d", $year_today, $mon_today, $day_today;

    my $year = $args{year} // $year_today;
    my $mon  = $args{month};
    my $day  = $args{day};

    my $modules;
    if ($args{all_modules}) {
        $modules = list_calendar_dates_modules()->[2];
    } elsif ($args{modules}) {
        $modules = $args{modules};
    } else {
        return [400, "Please specify modules or all_modules"];
    }

    my $params = {};
    $params->{include_tags} = delete $args{include_tags}
        if $args{include_tags};
    $params->{exclude_tags} = delete $args{exclude_tags}

lib/App/CalendarDatesUtils.pm  view on Meta::CPAN

=head1 VERSION

This document describes version 0.011 of App::CalendarDatesUtils (from Perl distribution App-CalendarDatesUtils), released on 2019-12-11.

=head1 DESCRIPTION

This distributions provides the following command-line utilities:

=over

=item * L<list-calendar-dates>

=item * L<list-calendar-dates-modules>

=back

=head1 FUNCTIONS


=head2 list_calendar_dates

Usage:

 list_calendar_dates(%args) -> [status, msg, payload, meta]

List dates from one or more Calendar::Dates::* modules.

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<action> => I<str> (default: "list-dates")

lib/App/CalendarDatesUtils.pm  view on Meta::CPAN

(200 means OK, 4xx caller error, 5xx function error). Second element
(msg) is a string containing error message, or 'OK' if status is
200. Third element (payload) is optional, the actual result. Fourth
element (meta) is called result metadata and is optional, a hash
that contains extra information.

Return value:  (any)



=head2 list_calendar_dates_modules

Usage:

 list_calendar_dates_modules() -> [status, msg, payload, meta]

List Calendar::Dates::* modules, without the prefix.

This function is not exported.

No arguments.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code

script/list-calendar-dates  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/CalendarDatesUtils/list_calendar_dates
# and generated automatically using Perinci::CmdLine::Gen version 0.491

our $DATE = '2019-12-11'; # DATE
our $DIST = 'App-CalendarDatesUtils'; # DIST
our $VERSION = '0.011'; # VERSION

use 5.010001;
use strict;
use warnings;

use Perinci::CmdLine::Classic;

my $cmdline = Perinci::CmdLine::Classic->new(
    url => "/App/CalendarDatesUtils/list_calendar_dates",
    program_name => "list-calendar-dates",
    read_config => 0,
    read_env => 0,
    use_utf8 => 1,
);

$cmdline->run;

# ABSTRACT: List dates from one or more Calendar::Dates::* modules
# PODNAME: list-calendar-dates

__END__

=pod

=encoding UTF-8

=head1 NAME

list-calendar-dates - List dates from one or more Calendar::Dates::* modules

=head1 VERSION

This document describes version 0.011 of list-calendar-dates (from Perl distribution App-CalendarDatesUtils), released on 2019-12-11.

=head1 SYNOPSIS

Usage:

 % list-calendar-dates [options] [year] [month] [day]

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--action>=I<s>

script/list-calendar-dates  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C list-calendar-dates list-calendar-dates

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete list-calendar-dates 'p/*/`list-calendar-dates`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

script/list-calendar-dates-modules  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/CalendarDatesUtils/list_calendar_dates_modules
# and generated automatically using Perinci::CmdLine::Gen version 0.491

our $DATE = '2019-12-11'; # DATE
our $DIST = 'App-CalendarDatesUtils'; # DIST
our $VERSION = '0.011'; # VERSION

use 5.010001;
use strict;
use warnings;

use Perinci::CmdLine::Any;

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/CalendarDatesUtils/list_calendar_dates_modules",
    program_name => "list-calendar-dates-modules",
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: List Calendar::Dates::* modules, without the prefix
# PODNAME: list-calendar-dates-modules

__END__

=pod

=encoding UTF-8

=head1 NAME

list-calendar-dates-modules - List Calendar::Dates::* modules, without the prefix

=head1 VERSION

This document describes version 0.011 of list-calendar-dates-modules (from Perl distribution App-CalendarDatesUtils), released on 2019-12-11.

=head1 SYNOPSIS

Usage:

 % list-calendar-dates-modules [options]

=head1 OPTIONS

C<*> marks required options.

=head2 Output options

=over

=item B<--format>=I<s>

script/list-calendar-dates-modules  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C list-calendar-dates-modules list-calendar-dates-modules

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete list-calendar-dates-modules 'p/*/`list-calendar-dates-modules`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

t/00-compile.t  view on Meta::CPAN


use Test::More;

plan tests => 3 + ($ENV{AUTHOR_TESTING} ? 1 : 0);

my @module_files = (
    'App/CalendarDatesUtils.pm'
);

my @scripts = (
    'script/list-calendar-dates',
    'script/list-calendar-dates-modules'
);

# no fake home requested

my @switches = (
    -d 'blib' ? '-Mblib' : '-Ilib',
);

use File::Spec;
use IPC::Open3;

t/author-critic.t  view on Meta::CPAN

}


use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.003

use Test::Perl::Critic (-profile => "") x!! -e "";

my $filenames = ['lib/App/CalendarDatesUtils.pm','script/list-calendar-dates','script/list-calendar-dates-modules'];
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);



( run in 0.559 second using v1.01-cache-2.11-cpan-5dc5da66d9d )