Antsy

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	* fix extra file in MANIFEST (#11)

0.904 2024-01-07T22:57:43Z
	* refresh distro

0.903 2021-12-24T16:17:51Z
	* The previous release had a problem with the Changes file

0.902 2021-12-24T16:06:36Z
	* ki3v sent a correction for the ordering of the clear_* numbers. Github #1
	* Added iTerm2 sequences https://iterm2.com/documentation-escape-codes.html

0.901 2021-02-25T20:33:25Z
	* First release.

META.json  view on Meta::CPAN

{
   "abstract" : "Streaming ANSI escape sequences",
   "author" : [
      "brian d foy <briandfoy@pobox.com>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "artistic_2"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Streaming ANSI escape sequences'
author:
  - 'brian d foy <briandfoy@pobox.com>'
build_requires:
  Test::More: '1'
configure_requires:
  ExtUtils::MakeMaker: '6.64'
  File::Spec::Functions: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010'
license: artistic_2

lib/Antsy.pm  view on Meta::CPAN

use Exporter qw(import);

our( @EXPORT, @EXPORT_OK, %EXPORT_TAGS );

our $VERSION = '0.907';

=encoding utf8

=head1 NAME

Antsy - Streaming ANSI escape sequences

=head1 SYNOPSIS

	use Antsy qw(:all);

	print bold, underline, text_red, "Hello", reset;

=head1 DESCRIPTION

Subroutines to deal with ANSI terminal sequences. You can emit these

lib/Antsy.pm  view on Meta::CPAN

	}

sub _rgb ( $i, $r, $g, $b ) {
	carp "Bad RGB $r;$b;$g" unless
		3 == grep { int($_) == $_ and $_ >= 0 and $_ <= 255 }
			( $r, $b, $g );

	_seq( 'm', $i, 2, $r, $g, $b );
	}

# _seq forms the ANSI escape sequence. There's the start, some arguments
# separated by `;`, then a string for the argument
sub _seq ( $command, @args ) { join '', "\x1b[", join( ';', @args ), $command }

sub _encode_seq ( $string ) {
	local $_ = $string;

	s/(.)/sprintf '%02X ', ord($1) /ge;

	s/1b /ESC /ig;
	s/07 /BEL /ig;

lib/Antsy.pm  view on Meta::CPAN


=item * copy_to_pasteboard

You can place a string in the system's pasteboard with this sequence:

OSC 1337 ; Copy=:[base64] ST
Where [base64] is the base64-encoded string to copy to the pasteboard.

=item * report_variable

Each iTerm2 session has internal variables (as described in Scripting Fundamentals). This escape sequence reports a variable's value:

OSC 1337 ; ReportVariable=[base64] ST
Where [base64] is a base64-encoded variable name, like session.name. It responds with:

OSC 1337 ; ReportVariable=[base64] ST
Where [base64] is a base64-encoded value.

https://iterm2.com/documentation-scripting-fundamentals.html

=item * badge

lib/Antsy.pm  view on Meta::CPAN

# Set badge to show the current session name and git branch, if any is set.
printf "\e]1337;SetBadgeFormat=%s\a" \
  $(echo -n "\(session.name) \(user.gitBranch)" | base64)

=item * downloads

https://iterm2.com/documentation-images.html

The width and height are given as a number followed by a unit, or the word "auto".

iTerm2 extends the xterm protocol with a set of proprietary escape sequences. In general, the pattern is:

ESC ] 1337 ; key = value ^G
Whitespace is shown here for ease of reading: in practice, no spaces should be used.

For file transfer and inline images, the code is:

ESC ] 1337 ; File = [arguments] : base-64 encoded file contents ^G
The arguments are formatted as key=value with a semicolon between each key-value pair. They are described below:

Key		Description of value

lib/Antsy.pm  view on Meta::CPAN

Where [n] is 8 or 9

You can push the current value on a stack and pop it off to return to the previous value by setting n to push or pop. Optionally, you may affix a label after push by setting n to something like push mylabel. This attaches a label to that stack entry....

=back

=head1 SEE ALSO

=over 4

=item * Everything you never wanted to know about ANSI escape codes https://notes.burke.libbey.me/ansi-escape-codes/

=item * https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797

=item * iTerm2 ANSI codes https://iterm2.com/documentation-escape-codes.html

=back

=head1 SOURCE AVAILABILITY

This source is in Github:

	http://github.com/briandfoy/antsy

=head1 AUTHOR



( run in 0.640 second using v1.01-cache-2.11-cpan-c21f80fb71c )