-
-
08 Jun 2020 08:15:56 UTC
- Distribution: Term-App-Roles
- Module version: 0.031
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (1593 / 0 / 2)
- Kwalitee
Bus factor: 1- % Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (15.8KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- NAME
- VERSION
- DESCRIPTION
- ATTRIBUTES
- use_utf8 => BOOL (default: from env, or detected from terminal)
- use_box_chars => BOOL (default: from env, or detected from OS)
- interactive => BOOL (default: from env, or detected from terminal)
- use_color => BOOL (default: from env, or detected from terminal)
- color_depth => INT (or STR, default: from env, or detected from terminal)
- term_width => INT (default: from env, or detected from terminal)
- term_height => INT (default: from env, or detected from terminal)
- METHODS
- ENVIRONMENT
- HOMEPAGE
- SOURCE
- BUGS
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
Term::App::Role::Attrs - Role for terminal-related attributes
VERSION
This document describes version 0.031 of Term::App::Role::Attrs (from Perl distribution Term-App-Roles), released on 2020-06-08.
DESCRIPTION
This role gives several options to turn on/off terminal-oriented features like whether to use UTF8 characters, whether to use colors, and color depth. Defaults are set from environment variables or by detecting terminal software/capabilities.
ATTRIBUTES
use_utf8 => BOOL (default: from env, or detected from terminal)
The default is retrieved from environment: if
UTF8
is set, it is used. Otherwise, the default is on if terminal emulator software supports Unicode and language (LANG/LANGUAGE) setting has /utf-?8/i in it.use_box_chars => BOOL (default: from env, or detected from OS)
Default is 0 for Windows.
interactive => BOOL (default: from env, or detected from terminal)
use_color => BOOL (default: from env, or detected from terminal)
For convenience, this attribute is "linked" with
color_depth
. Settinguse_color
will also setcolor_depth
when the value is not ''/1/0 and matches color depth pattern. For example, settinguse_color
to 256 or '8bit' will also setcolor_depth
to 256.color_depth => INT (or STR, default: from env, or detected from terminal)
Get/set color depth. When setting, you can use string like '8 bit' or '24b' and it will be converted to 256 (2**8) or 16777216 (2**24).
For convenience, this attribute is "linked" with
use_color
. Settingcolor_depth
to non-zero value will enableuse_color
, while setting it to 0 will disableuse_color
.term_width => INT (default: from env, or detected from terminal)
term_height => INT (default: from env, or detected from terminal)
METHODS
detect_terminal() => HASH
Call Term::Detect::Software's
detect_terminal_cached
.ENVIRONMENT
UTF8 => BOOL
Can be used to set
use_utf8
.INTERACTIVE => BOOL
Can be used to set
interactive
.NO_COLOR
Can be used to disable color. Takes precedence over
COLOR
.For more information, see https://no-color.org.
COLOR => BOOL (or INT or STR)
Can be used to set
use_color
. Can also be used to setcolor_depth
(ifCOLOR_DEPTH
is not defined).COLOR_DEPTH => INT (or STR)
Can be used to set
color_depth
. Can also be used to enable/disableuse_color
.BOX_CHARS => BOOL
Can be used to set
use_box_chars
.COLUMNS => INT
Can be used to set
term_width
.LINES => INT
Can be used to set
term_height
.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Term-App-Roles.
SOURCE
Source repository is at https://github.com/perlancar/perl-Term-App-Roles.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Term-App-Roles
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020, 2018, 2014 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Term::App::Roles, copy and paste the appropriate command in to your terminal.
cpanm Term::App::Roles
perl -MCPAN -e shell install Term::App::Roles
For more information on module installation, please visit the detailed CPAN module installation guide.