App-AltSQL

 view release on metacpan or  search on metacpan

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

=item B<prompt>

  prompt: "%u@%h[%d]> "
  # 'username@hostname[database]> '
  prompt: "%c{red}%u%c{reset} %t{%F %T}> '
  # 'username' (in red) ' YYYY-MM-DD HH:MM:SS> '

Provide a custom prompt.  The following variables will be interpolated:

=over 4

=item B<%u>

The username used to connect to the model

=item B<%d>

The current database or '(none)'

=item B<%h>

The hostname the model is connected to

=item B<%%>

An escaped percent sign

=item B<%c{...}>

A L<Term::ANSIColor> color name.  The value will be passed directly to the C<color> method.

=item B<%e{...}>

A block to be eval'ed.  You may use $self to refer to the L<App::AltSQL::Term> object

=item B<%t{...}>

The argument to this option will be passed to L<DateTime> C<strftime> for the current time

=back

=item B<plugins>

An array of plugin names for the main namespace.

=item B<view_plugins>

An array of View plugin names to be applied to each View object created

=back

=head1 EXTENDING

As mentioned above, one key point of this project is to make it easy for people to extend.  For this reason, I've built it on L<Moose> and offer a L<MooseX::Object::Pluggable> interface.  If you extend C<App::AltSQL>, you may want to know about the f...

=cut

use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Params::Validate;
use Data::Dumper;
use Config::Any;
use Hash::Union qw(union);

our $VERSION = 0.05;
our $| = 1;

# Don't emit 'Wide character in output' warnings
binmode STDOUT, ':utf8';

with 'MooseX::Object::Pluggable';

my @_config_stems = ( '/etc/altsql', "$ENV{HOME}/.altsql" );
my %_default_classes = (
	term => 'App::AltSQL::Term',
	view => 'App::AltSQL::View',
	model => 'App::AltSQL::Model::MySQL',
);
my %default_config = (
	plugins => [ 'Tail', 'Dump' ],
	view_plugins => [ 'Color', 'UnicodeBox' ],
	term_plugins => [],
);

=head2 Accessors

=over 4

=item term - the singleton L<App::AltSQL::Term> (or subclass) instance

=item view - the class in which all table output will be accomplished (defaults to L<App::AltSQL::View>)

=item model - where the database calls happen (L<App::AltSQL::Model::MySQL>)

=cut

has ['term', 'view', 'model']  => (is => 'ro');

=item args

Hash of the command line arguments

=item config

Hash of the file configuration

=back

=cut

has ['args', 'config'] => (is => 'rw');

## Configure

sub args_spec {
	return (
		help => {
			cli  => 'help|?',
		},
	);
}



( run in 0.595 second using v1.01-cache-2.11-cpan-39bf76dae61 )