CohortExplorer

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

config_files/log-config.properties
debian/cohortexplorer_0.14-1_all.deb
lib/CohortExplorer.pm
lib/CohortExplorer/Application.pm
lib/CohortExplorer/Application/Opal/Datasource.pm
lib/CohortExplorer/Application/REDCap/Datasource.pm
lib/CohortExplorer/Command/Describe.pm
lib/CohortExplorer/Command/Find.pm
lib/CohortExplorer/Command/Help.pm
lib/CohortExplorer/Command/History.pm
lib/CohortExplorer/Command/Menu.pm
lib/CohortExplorer/Command/Query.pm
lib/CohortExplorer/Command/Query/Compare.pm
lib/CohortExplorer/Command/Query/Search.pm
lib/CohortExplorer/Datasource.pm
LICENSE
Makefile.PL
MANIFEST            This list of files
META.yml
README
t/00-load.t

lib/CohortExplorer/Application.pm  view on Meta::CPAN

  {
   throw_app_opts_validation_exception(
                         error => "All mandatory parameters must be provided" );
  }
 }
}

sub command_map {
 console    => 'CLI::Framework::Command::Console',
   help     => 'CohortExplorer::Command::Help',
   menu     => 'CohortExplorer::Command::Menu',
   describe => 'CohortExplorer::Command::Describe',
   history  => 'CohortExplorer::Command::History',
   find     => 'CohortExplorer::Command::Find',
   search   => 'CohortExplorer::Command::Query::Search',
   compare  => 'CohortExplorer::Command::Query::Compare';
}

sub command_alias {
 h      => 'help',
   m    => 'menu',

lib/CohortExplorer/Application.pm  view on Meta::CPAN

   sh   => 'console';
}

sub noninteractive_commands {
 my ($app) = @_;
 my $ds = $app->cache->get('cache')->{datasource};

 # May or may not be preloaded
 eval 'require ' . ref $ds;

 # Menu and console commands are invalid under interactive mode
 push my @noninteractive_command, qw/menu console/;

 # search, compare and history commands are invalid if the user
 # does not have access to any variable
 if ( keys %{ $ds->variable_info } == 0 ) {
  push @noninteractive_command, qw/search history compare/;
 }

 # Compare command is invalid only if
 # visit variables are defined

lib/CohortExplorer/Application.pm  view on Meta::CPAN

=head2 validate_options( $opts )

This method ensures the user has supplied all mandatory options such as datasource, username and password.

=head2 command_map()

This method returns the mapping between command names and command classes
 
  console  => 'CLI::Framework::Command::Console',
  help     => 'CohortExplorer::Command::Help',
  menu     => 'CohortExplorer::Command::Menu',
  describe => 'CohortExplorer::Command::Describe',
  history  => 'CohortExplorer::Command::History',
  find     => 'CohortExplorer::Command::Find',
  search   => 'CohortExplorer::Command::Query::Search',
  compare  => 'CohortExplorer::Command::Query::Compare'

=head2 command_alias()

This method returns mapping between command aliases and command names

lib/CohortExplorer/Command/Menu.pm  view on Meta::CPAN

package CohortExplorer::Command::Menu;

use strict;
use warnings;

our $VERSION = 0.14;

use base qw( CLI::Framework::Command::Menu );

#-------
sub menu_txt {
 my ($self) = @_;
 my $app = $self->get_app;
 my ( @cmd, $txt );

 # Get all valid commands
 for my $c ( $app->get_interactive_commands ) {
  if ( grep ( $_ ne $c, $app->noninteractive_commands ) ) {

lib/CohortExplorer/Command/Menu.pm  view on Meta::CPAN

}

#-------
1;
__END__

=pod

=head1 NAME

CohortExplorer::Command::Menu - CohortExplorer class to show a command menu including the commands that are available to the running application

=head1 DESCRIPTION

This class is inherited from L<CLI::Framework::Command::Menu> and overrides C<menu_txt()>.

=head2 menu_txt()

This method creates a command menu including the commands that are available to the running application. Only a small modification has been made to the original code so the menu includes command aliases with command names.

=cut



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