CLI-Gwrap

 view release on metacpan or  search on metacpan

lib/CLI/Gwrap.pm  view on Meta::CPAN

        $self->{command} = _normalize_name($new);
    } );
has 'main_opt'      => (is => 'ro', isa => InstanceOf['CLI::Gwrap::Opt']);
has 'description'   => (is => 'ro', isa => Str);
has 'gwrapper_name' => (is => 'ro', isa => Str, default => 'wxGrid');
has 'gwrapper'      => (is => 'rw');
has 'columns'       => (is => 'rw', isa => Int, default => 3);
has 'verbatim'      => (is => 'ro', isa => Bool);
has 'help'          => (is => 'ro', isa => Str);
has 'persist'       => (is => 'ro', isa => Bool);
has 'opts'          => (is => 'ro', isa => ArrayRef[InstanceOf['CLI::Gwrap::Opt']]);
has 'advanced'      => (is => 'ro', isa => ArrayRef[InstanceOf['CLI::Gwrap::Opt']]);
has 'exec_callback' => (is => 'ro', isa => CodeRef);
has 'timeout'       => (is => 'ro', isa => Int);

sub BUILD {
    my ($self, $params) = @_;

    croak "No command to Gwrap!\n" if(not $self->command);

    my $plugin = "CLI/Gwrapper/$self->{gwrapper_name}.pm";
    require $plugin;

lib/CLI/Gwrap/Opt.pm  view on Meta::CPAN

use warnings;

package CLI::Gwrap::Opt;

use Moo;
use Types::Standard qw( Int Str ArrayRef HashRef CodeRef );

our $VERSION = '0.030'; # VERSION

has 'type'        => (is => 'ro', isa => Str);
has 'name'        => (is => 'ro', isa => ArrayRef, trigger => sub {
        my ($self, $new) = @_;

        if (not exists $self->{joiner}) {
            $self->{joiner} = $new->[0] =~ m/\A-?.\z/
                ? ' '       # single letter options, joiner defaults to space
                : '=';      # otherwise, use equals sign
            }
    },
);
has 'description' => (is => 'ro', isa => Str);
has 'state'       => (is => 'ro');
has 'label'       => (is => 'ro', isa => Str);
has 'choices'     => (is => 'ro', isa => ArrayRef[Str]); # for radio buttons
has 'width'       => (is => 'ro', isa => Int);
has 'joiner'      => (is => 'ro', isa => Str);
has 'widget'      => (is => 'rw');
has 'retriever'   => (is => 'rw', isa => CodeRef);

sub name_for_display {
    my ($self, $verbatim) = @_;

    return $self->label if (defined $self->label);  # override

lib/CLI/Gwrapper.pm  view on Meta::CPAN

our $VERSION = '0.030'; # VERSION

use Moo::Role;
use IPC::Run;

requires qw(
    title
    run
);

has 'command'       => (is => 'ro', isa => ArrayRef);
has 'main_opt'      => (is => 'ro', isa => InstanceOf['CLI::Gwrap::Opt']);
has 'description'   => (is => 'ro', isa => Str);
has 'verbatim'      => (is => 'ro', isa => Bool);
has 'help'          => (is => 'ro', isa => Str);
has 'persist'       => (is => 'ro', isa => Bool);
has 'columns'       => (is => 'rw', isa => Int, default => 3);
has 'opts'          => (
    is => 'ro',
    isa => ArrayRef[InstanceOf['CLI::Gwrap::Opt']],
    default => sub { return []},



( run in 0.876 second using v1.01-cache-2.11-cpan-5f2e87ce722 )