App-AltSQL
view release on metacpan or search on metacpan
'Term::ReadLine::Zoid' => 0,
'Sys::SigAction' => 0,
'Hash::Union' => 0,
'Getopt::Long' => 2.38,
'Data::Dumper' => 0,
'Config::Any' => 0,
'JSON' => 0,
'YAML' => 0,
},
suggests => {
'DateTime' => 0,
'JSON::XS' => 0,
'DBIx::MyParsePP' => 0,
'Text::ASCIITable' => 0,
},
create_makefile_pl => 'small',
meta_merge => {
resources => {
repository => "http://github.com/ewaters/altsql-shell",
homepage => "http://ewaters.github.com/altsql-shell",
bugtracker => "http://github.com/ewaters/altsql-shell/issues?labels=bug",
lib/App/AltSQL.pm view on Meta::CPAN
=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
lib/App/AltSQL/Term.pm view on Meta::CPAN
return 'err';
}
return $now->strftime($format);
},
);
sub render_prompt {
my ($self, $now) = @_;
if (! defined $self->{_has_datetime}) {
eval { require DateTime; };
$self->{_has_datetime} = $@ ? 0 : 1;
}
if (! $now && $self->{_has_datetime}) {
$now = DateTime->now( time_zone => 'local' );
}
my %context = (
self => $self,
date => $now,
);
my $prompt = $self->prompt;
my $output = '';
t/003_custom_prompt.t view on Meta::CPAN
## MySQL .my.cnf format
$model->{prompt} = '\\\\u@\\\\h[\\\\d]\\\\_';
is $model->parse_prompt(), '%u@%h[%d] ', "MySQL-style prompt converted into local style";
$model->{prompt} = '(\\\\u@\\\\h) [\\\\d]>\\\\_';
$term->prompt( $model->parse_prompt );
is $term->render_prompt(), '(testuser@localhost) [saklia]> ', "Issue #28 from .my.cnf";
## DateTime testing
eval { require DateTime; };
if ($@) {
print STDERR "Can't continue testing without DateTime\n";
done_testing;
exit;
}
my $now = DateTime->now();
$term->prompt('%u@%h[%t{%H:%M:%S}]> ');
is $term->render_prompt($now), 'testuser@localhost['.$now->strftime('%H:%M:%S').']> ', "Simple DateTime substitution";
done_testing;
( run in 0.339 second using v1.01-cache-2.11-cpan-05444aca049 )