App-AltSQL
    
    
  
  
  
view release on metacpan or search on metacpan
lib/App/AltSQL.pm view on Meta::CPAN
  view_plugins:
    - Color
    - UnicodeBox
  App::AltSQL::View::Plugin::Color:
    header_text:
      default: red
    cell_text:
      is_null: blue
      is_primary_key: bold
      is_number: yellow
  App::AltSQL::View::Plugin::UnicodeBox:
    style: heavy_header
    split_lines: 1
    plain_ascii: 0
  
This is the default configuration, and currently encompasses all the configurable settings.  This should be future safe; as you can see, plugins may use this file for their own variables as there are namespaced sections.
=over 4
lib/App/AltSQL/Plugin/Dump/Format/xls.pm view on Meta::CPAN
sub format {
    my ($self, %params) = @_;
    my $filename   = $params{filename};
    my $table_data = $params{table_data}; 
    my $workbook  = Spreadsheet::WriteExcel::Big->new($filename);
    my $worksheet = $workbook->add_worksheet();
    my $header_format = $workbook->add_format;
    $header_format->set_bold;
    my $col_pos = 0;
    my $row_pos = 0;
    # write header
    for my $column ( @{ $table_data->{columns} } ) {
        $worksheet->write(0, $col_pos++, $column->{name}, $header_format);
    }
    # move down 2 lines, let it breath some
lib/App/AltSQL/View/Plugin/Color.pm view on Meta::CPAN
=head1 DESCRIPTION
This uses the L<App::AltSQL> configuration file for customizing how things are colored.  The default configuration is:
  header_text => {
    default => 'red',
  },
  cell_text => {
    is_null => 'blue',
    is_primary_key => 'bold',
    is_number => 'yellow',
  }
The values are passed to L<Term::ANSIColor> so any supported color may be used.
=cut
use Moose::Role;
use Term::ANSIColor qw(color colored);
my %default_config = (
	header_text => {
		default => 'red',
	},
	cell_text => {
		is_null => 'blue',
		is_primary_key => 'bold',
		is_number => 'yellow',
	},
);
sub format_column_cell {
	my ($self, $spec) = @_;
	return colored $spec->{name}, $self->resolve_namespace_config_value(__PACKAGE__, [ 'header_text', 'default' ], \%default_config);
}
t/003_custom_prompt.t view on Meta::CPAN
is $term->render_prompt(), '2> ', "Arbitrary perl, part two";
$term->prompt('%e{ missing end brace');
is $term->render_prompt(), '', "Missing end brace";
$term->prompt('%e{ invalid perl code }');
is $term->render_prompt(), 'err', "Invalid perl code";
## Color
$term->prompt('%c{bold}%u%c{reset}%c{bold red}@%h%c{reset}> ');
is $term->render_prompt(),
	colored('testuser', 'bold') . colored('@localhost', 'bold red') . '> ',
	"Colored prompt";
## 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";
( run in 1.011 second using v1.01-cache-2.11-cpan-c333fce770f )