App-FireDiamondUtils

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/App/FireDiamondUtils.pm
script/explain-fire-diamond-text-notation
script/parse-fire-diamond-text-notation
script/show-fire-diamond-legends
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

            "name" : "GenPericmdScript explain-fire-diamond-text-notation",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript parse-fire-diamond-text-notation",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript show-fire-diamond-legends",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::InsertExecsList",
            "name" : "InsertExecsList",
            "version" : "0.032"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease",
            "name" : "@Author::PERLANCAR/PERLANCAR::CheckPendingRelease",

META.yml  view on Meta::CPAN

    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript explain-fire-diamond-text-notation'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript parse-fire-diamond-text-notation'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript show-fire-diamond-legends'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::InsertExecsList
      name: InsertExecsList
      version: '0.032'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease
      name: '@Author::PERLANCAR/PERLANCAR::CheckPendingRelease'
      version: '0.001'
    -

Makefile.PL  view on Meta::CPAN

my %WriteMakefileArgs = (
  "ABSTRACT" => "Utilities related to fire diamond (NFPA 704 standard)",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "App-FireDiamondUtils",
  "EXE_FILES" => [
    "script/explain-fire-diamond-text-notation",
    "script/parse-fire-diamond-text-notation",
    "script/show-fire-diamond-legends"
  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010001",
  "NAME" => "App::FireDiamondUtils",
  "PREREQ_PM" => {
    "Data::Sah::Compiler::perl::TH::bool" => "0.914",
    "Data::Sah::Compiler::perl::TH::str" => "0.914",
    "Parse::FireDiamond" => "0.004",
    "Perinci::CmdLine::Any" => "0.154",
    "Perinci::CmdLine::Lite" => "1.924",

README  view on Meta::CPAN

    This document describes version 0.003 of App::FireDiamondUtils (from
    Perl distribution App-FireDiamondUtils), released on 2023-03-29.

DESCRIPTION
    This distributions provides the following command-line utilities:

    *   explain-fire-diamond-text-notation

    *   parse-fire-diamond-text-notation

    *   show-fire-diamond-legends

FUNCTIONS
  explain_fire_diamond_text_notation
    Usage:

     explain_fire_diamond_text_notation(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Explain fire diamond text notation in several ways.

    Examples:

README  view on Meta::CPAN

    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  show_fire_diamond_legends
    Usage:

     show_fire_diamond_legends(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Show a table that explains the meaning of each number and symbol in the
    Fire Diamond notation.

    Examples:

    *   Show the short table:

         show_fire_diamond_legends(); # -> [200, undef, undef, {}]

    *   Show the long/verbose table:

         show_fire_diamond_legends(detail => 1); # -> [200, undef, undef, {}]

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   detail => *bool*

        Show the longer explanation instead of just the meaning.

    Returns an enveloped result (an array).

dist.ini  view on Meta::CPAN

[GenPericmdScript / GenPericmdScript explain-fire-diamond-text-notation]
url=/App/FireDiamondUtils/explain_fire_diamond_text_notation
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript parse-fire-diamond-text-notation]
url=/Parse/FireDiamond/parse_fire_diamond_text_notation
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript show-fire-diamond-legends]
url=/App/FireDiamondUtils/show_fire_diamond_legends
read_config=0
read_env=0

[InsertExecsList]

[@Author::PERLANCAR]
:version=0.606

[Prereqs]
perl=5.010001

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

        }
        $t->add_row_separator;

        binmode(STDOUT, ":utf8"); ## no critic: InputOutput::RequireEncodingWithUTF8Layer
        print $t->draw;
    }

    [200];
}

$SPEC{'show_fire_diamond_legends'} = {
    v => 1.1,
    summary => 'Show a table that explains the meaning of each number and symbol in the Fire Diamond notation',
    args => {
        detail => {
            summary => 'Show the longer explanation instead of just the meaning',
            schema => 'bool*',
            cmdline_aliases => {l=>{}},
        },
    },
    examples => [
        {
            summary=>'Show the short table',
            argv=>[],
        },
        {
            summary=>'Show the long/verbose table',
            argv=>["-l"],
        },
    ],
};
sub show_fire_diamond_legends {
    require Parse::FireDiamond;
    require Text::ANSITable;

    my %args = @_;

    my $t = Text::ANSITable->new;
    $t->columns(["Num/Sym", "Meaning", ( $args{detail} ? ("Explanation") : () )]);

    my $rownum = 0;

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

=head1 DESCRIPTION

This distributions provides the following command-line utilities:

=over

=item * L<explain-fire-diamond-text-notation>

=item * L<parse-fire-diamond-text-notation>

=item * L<show-fire-diamond-legends>

=back

=head1 FUNCTIONS


=head2 explain_fire_diamond_text_notation

Usage:

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

(200 means OK, 4xx caller error, 5xx function error). Second element
($reason) is a string containing error message, or something like "OK" if status is
200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth
element (%result_meta) is called result metadata and is optional, a hash
that contains extra information, much like how HTTP response headers provide additional metadata.

Return value:  (any)



=head2 show_fire_diamond_legends

Usage:

 show_fire_diamond_legends(%args) -> [$status_code, $reason, $payload, \%result_meta]

Show a table that explains the meaning of each number and symbol in the Fire Diamond notation.

Examples:

=over

=item * Show the short table:

 show_fire_diamond_legends(); # -> [200, undef, undef, {}]

=item * Show the longE<sol>verbose table:

 show_fire_diamond_legends(detail => 1); # -> [200, undef, undef, {}]

=back

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<detail> => I<bool>

script/show-fire-diamond-legends  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/FireDiamondUtils/show_fire_diamond_legends
# and generated automatically using Perinci::CmdLine::Gen version 0.502

use 5.010001;
use strict;
use warnings;

use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2023-03-29'; # DATE
our $DIST = 'App-FireDiamondUtils'; # DIST
our $VERSION = '0.003'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/FireDiamondUtils/show_fire_diamond_legends",
    program_name => "show-fire-diamond-legends",
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Show a table that explains the meaning of each number and symbol in the Fire Diamond notation
# PODNAME: show-fire-diamond-legends

__END__

=pod

=encoding UTF-8

=head1 NAME

show-fire-diamond-legends - Show a table that explains the meaning of each number and symbol in the Fire Diamond notation

=head1 VERSION

This document describes version 0.003 of show-fire-diamond-legends (from Perl distribution App-FireDiamondUtils), released on 2023-03-29.

=head1 SYNOPSIS

B<show-fire-diamond-legends> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<show-fire-diamond-legends> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<show-fire-diamond-legends> [B<L<--detail|/"--detail, -l">>|B<L<-l|/"--detail, -l">>|B<L<--no-detail|/"--detail, -l">>|B<L<--nodetail|/"--detail, -l">>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--(no)naked-res|/"--naked-res...



See examples in the L</EXAMPLES> section.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

script/show-fire-diamond-legends  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 show-fire-diamond-legends show-fire-diamond-legends

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 show-fire-diamond-legends 'p/*/`show-fire-diamond-legends`/'

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.

=head1 EXAMPLES

=head2 Show the short table

 % show-fire-diamond-legends
 
=head2 Show the long/verbose table

 % show-fire-diamond-legends -l
 
=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-FireDiamondUtils>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-FireDiamondUtils>.

=head1 AUTHOR

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


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

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

my @scripts = (
    'script/explain-fire-diamond-text-notation',
    'script/parse-fire-diamond-text-notation',
    'script/show-fire-diamond-legends'
);

# 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.006

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

my $filenames = ['lib/App/FireDiamondUtils.pm','script/explain-fire-diamond-text-notation','script/parse-fire-diamond-text-notation','script/show-fire-diamond-legends'];
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);



( run in 1.253 second using v1.01-cache-2.11-cpan-49f99fa48dc )