Antsy
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
use v5.008;
package Antsy;
use strict;
use warnings;
=encoding utf8
=head1 The build file for Antsy
This build file is a modulino; it works as both a build script and
a module.
To build the distribution, run this file normally:
% perl Makefile.PL
=pod
=encoding utf8
=for HTML <a href="https://www.github.com/briandfoy/antsy/actions?query=workflow%3Amacos"><img src="https://www.github.com/briandfoy/antsy/workflows/macos/badge.svg"></a>
=for HTML <a href="https://www.github.com/briandfoy/antsy/actions?query=workflow%3Aubuntu"><img src="https://www.github.com/briandfoy/antsy/workflows/ubuntu/badge.svg"></a>
=for HTML <a href="https://www.github.com/briandfoy/antsy/actions?query=workflow%3Awindows"><img src="https://www.github.com/briandfoy/antsy/workflows/windows/badge.svg"></a>
=for HTML <a href='https://ci.appveyor.com/project/briandfoy/antsy'><img src='https://ci.appveyor.com/api/projects/status/bmve9x6oe8npv9q6?svg=true'></a>
=for HTML <a href='https://coveralls.io/github/briandfoy/antsy?branch=master'><img src='https://coveralls.io/repos/github/briandfoy/antsy/badge.svg?branch=master' alt='Coverage Status' /></a>
examples/back_up_three_lines.pl view on Meta::CPAN
#!perl
use v5.26;
use utf8;
use open qw(:std :utf8);
use FindBin qw($Bin);
use lib "$FindBin::Bin/../lib";
use Tie::Cycle;
use Time::HiRes qw(sleep);
use Antsy qw(:all);
$|++;
examples/subtasks.pl view on Meta::CPAN
#!perl
use v5.38;
use utf8;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Time::HiRes qw(sleep);
use Antsy 0.908 qw( cursor_hide cursor_show );
package Subtask {
use Antsy 0.908 qw(
bold faint text_green text_yellow text_red reset_all
examples/subtasks.pl view on Meta::CPAN
these honored dead we take increased devotion to that cause for which
they gave the last full measure of devotion, that we here highly
resolve that these dead shall not have died in vain, that this nation,
under God, shall have a new birth of freedom, and that government of the
people, by the people, for the people, shall not perish from the earth.
TEXT
}
__END__
=encoding utf8
=head1 NAME
subtasks.pl - show subtasks with persistent headers and scrolling output
=head1 SYNOPSIS
$ perl examples/subtasks.pl
=head1 DESCRIPTION
lib/Antsy.pm view on Meta::CPAN
use v5.26;
package Antsy;
use strict;
use warnings;
use utf8;
use experimental qw(signatures);
use Carp qw(carp);
use Exporter qw(import);
our( @EXPORT, @EXPORT_OK, %EXPORT_TAGS );
our $VERSION = '0.908';
=encoding utf8
=head1 NAME
Antsy - Streaming ANSI escape sequences
=head1 SYNOPSIS
use Antsy qw(:all);
print bold, underline, text_red, "Hello", reset_all;
t/aliases.t view on Meta::CPAN
use utf8;
use Test::More;
my $class = 'Antsy';
BAIL_OUT( "Bail out! $class did not compile\n" ) unless use_ok( $class );
# Each group lists names that should be interchangeable. A plain name is
# called with no arguments. An array reference is a name followed by the
# arguments to call it with.
my @fixed_groups = (
# attributes
t/aliases.t view on Meta::CPAN
label( [ $name, @$args ] ) . ' is the same as ' . label( [ $first, @$args ] ) );
}
}
};
}
done_testing();
__END__
=encoding utf8
=head1 NAME
t/aliases.t - check that Antsy's aliases return the same thing
=head1 SYNOPSIS
$ prove -l t/aliases.t
=head1 DESCRIPTION
t/attributes.t view on Meta::CPAN
use utf8;
use Test::More;
my $class = 'Antsy';
BAIL_OUT( "Bail out! $class did not compile\n" ) unless use_ok( $class );
my %attributes = (
# NAME SGR
reset => 0,
reset_all => 0,
normal => 0,
t/attributes.t view on Meta::CPAN
reverse 1, 2, 3;
};
is( $@, '', 'code that imports :all compiles and runs' );
is( "@reversed", '3 2 1', 'reverse is still the builtin' );
};
done_testing();
__END__
=encoding utf8
=head1 NAME
t/attributes.t - check Antsy's text attribute functions
=head1 SYNOPSIS
$ prove -l t/attributes.t
=head1 DESCRIPTION
use utf8;
use Test::More;
my $class = 'Antsy';
BAIL_OUT( "Bail out! $class did not compile\n" ) unless use_ok( $class );
my @basic_colors = qw( black red green yellow blue magenta cyan white );
my @extra_colors = qw( orange );
# gray and grey are aliases for bright black, so they're bright colors
my @gray_names = map { ( "text_$_", "bg_$_" ) } qw( gray grey );
my $name = "_$color";
ok( ! defined &{"${class}::$name"}, "$name is not defined" );
ok( ! $exportable{$name}, "$name is not in \@EXPORT_OK" );
}
};
done_testing();
__END__
=encoding utf8
=head1 NAME
t/colors.t - check that Antsy defines and exports every color function
=head1 SYNOPSIS
$ prove -l t/colors.t
=head1 DESCRIPTION
use utf8;
use Test::More;
my $class = 'Antsy';
BAIL_OUT( "Bail out! $class did not compile\n" ) unless use_ok( $class );
my $start_of_line = "\e[1G";
my %moves = (
# NAME COMMAND WHAT 0 RETURNS
cursor_back => [ 'D', '' ],
is_deeply( [ $parse->( "\e[12;34R" ) ], [ 12, 34 ], 'parses a reply' );
is_deeply( [ $parse->( "junk\e[1;1R" ) ], [ 1, 1 ], 'ignores junk before the reply' );
is_deeply( [ $parse->( '' ) ], [], 'no reply returns the empty list' );
is_deeply( [ $parse->( "\e[12;34" ) ], [], 'a cut-off reply returns the empty list' );
};
done_testing();
__END__
=encoding utf8
=head1 NAME
t/cursor.t - check Antsy's counted cursor and scroll moves
=head1 SYNOPSIS
$ prove -l t/cursor.t
=head1 DESCRIPTION
use utf8;
use Test::More;
my $class = 'Antsy';
BAIL_OUT( "Bail out! $class did not compile\n" ) unless use_ok( $class );
my %exportable = map { $_ => 1 } @Antsy::EXPORT_OK;
my %general = (
# SUB COMMAND ALLOWED
erase_in_display => [ 'J', 0 .. 3 ],
ok( defined $code, "$name is defined" ) or return;
ok( $exportable{$name}, "$name is in \@EXPORT_OK" );
is( $code->(), $helpers{$name}, "$name returns the right sequence" );
};
}
done_testing();
__END__
=encoding utf8
=head1 NAME
t/erase.t - check Antsy's erase functions
=head1 SYNOPSIS
$ prove -l t/erase.t
=head1 DESCRIPTION
use utf8;
use Test::More;
# Only run these in iTerm2 on macOS.
unless( $^O eq 'darwin' and ( $ENV{TERM_PROGRAM} // '' ) eq 'iTerm.app' ) {
plan skip_all => 'these tests run only in iTerm2 on macOS';
}
my $class = 'Antsy';
BAIL_OUT( "Bail out! $class did not compile\n" ) unless use_ok( $class );
my $other = run_perl( undef, 'print Antsy::iterm_set_cursor_shape(0) // q(UNDEF)' );
like( $other, qr/\AAntsy::iterm_set_cursor_shape only works in iTerm2 at /,
'outside iTerm2, it warns, naming itself' );
like( $other, qr/UNDEF\z/, 'outside iTerm2, it returns nothing' );
};
done_testing();
__END__
=encoding utf8
=head1 NAME
t/iterm.t - check Antsy's iTerm2 cursor shape functions
=head1 SYNOPSIS
$ prove -l t/iterm.t
=head1 DESCRIPTION
( run in 3.502 seconds using v1.01-cache-2.11-cpan-234fa220139 )