print-utf8
— Print
UTF-8 strings
print-utf8 |
[-h | --help ]
[-v | --version ]
[-n | --newline ]
[-i indentation
string | --indent
indentation string]
[-x console_width |
--columns console_width]
[-c string |
--center string]
[-x console_width |
--columns console_width]
[-I file ...
indentation left
right | --multiline-indent
indentation left
right]
[-x console_width |
--columns console_width]
[-C left
right | --multiline-center
left right]
[-x console_width |
--columns console_width]
[-s left
separator right |
--separator left
separator right]
[-b string |
--size string]
[-l string |
--length string]
[-w string |
--width string]
[-a string |
--size-length-width string]
[-t | --terminal-info ] |
print-utf8 is a simple program to print UTF-8 strings in the
console with options for indentation, centering, separator as well as
size/length/width information. If /dev/tty is not available to obtain the
terminal width and height, the default of 80x24 is assumed.
The following options are available:
-h
|
--help
- Prints command-line parameters.
-v
|
--version
- Prints program version.
-n
|
--newline
- Add a newline to the output. Default: off.
-i
indentation string |
--indent
indentation string
- Indent the string by the given number of characters (columns in the
console). A negative number leads to left-justified text, a positive
number leads to right-justified text.
-c
string |
--center
string
- Center the string, using indentation based on the current console
width.
-m
left right |
--multiline-center
left right
- Reads multiple lines from stdin, pads them to the same length, and prints
them centered with given borders on left and right side.
-s
left separator
right |
--separator
left separator
right
- Make a separator, consisting of a left part, a variable number of
separator string occurrences, as well as a right part. The separator
string must have a width >= 1 to fill the line. Otherwise, a space
(" ") is used instead.
-x
console_width |
--columns
console_width
- Set number of columns (console width) for "center",
"multiline-center", and "separator" functions (see
above). For console_width=0, the current console width (or from 80, if
unknown) is used. For console_width<0, the current console width (or
from 80, if unknown) plus console_width (subtraction, since it is
negative!) is used. Default: 0, i.e. current console width.
-b
string |
--size
string
- Print the size (bytes) of the string without ANSI control sequences.
-l
string |
--length
string
- Print the length (in UTF-8 characters) of the string without ANSI control
sequences.
-w
string |
--width
string
- Print the width (columns in the console) of the string without ANSI
control sequences.
-a
string |
--size-length-width
string
- Printf the size, length and width of the string without ANSI control
sequences.
-t
|
--terminal-info
- Print current width and height of the console. Note that if /dev/tty is
not available, the default of 80x24 is returned!
- print-utf8 -h
-
- print-utf8 --help
-
- print-utf8 --version
-
- print-utf8 --newline --center "This line is centered in console
width!"
-
- print-utf8 --newline --columns 80 --center "This line is centered in
80 columns!"
-
- print-utf8 --newline --center '\x1b[38;2;241;71;29mThis line is
centered!\x1b[0m'
-
- figlet "This is a test!" | print-utf8 --newline
--multiline-center "<🏁" "🏁>"
-
- figlet "This is another test!" | print-utf8 -x -8 -n -C
"<🏁" "🏁>"
-
- figlet Right | print-utf8 -n -I +72 "😀"
"😀"
-
- figlet Left | print-utf8 -n -I -72 "😀"
"😀"
-
- date +"%d. %m. %Y %H:%M:%S" | figlet -w 128 | ./print-utf8 -n -C
"[🕑" "🕑]"
-
- print-utf8 -n -c "😀😀😀 This line is centered
in console width! 😀😀😀"
-
- print-utf8 -n -x 80 -c "😀😀😀 This line is
centered in 80 columns! 😀😀😀"
-
- print-utf8 --indent -32 "Left: " && echo
"1234"
-
- print-utf8 --indent +32 "Right: " && echo
"1234"
-
- print-utf8 --newline --separator "<*" "="
"*>"
-
- print-utf8 --columns 80 --newline --separator "<*"
"=" "*>"
-
- print-utf8 -n -s "<💻😀" "="
"😀💻>"
-
- print-utf8 --width "Test"
-
- print-utf8 --width "Test äöü"
-
- print-utf8 -b "😀 Test 😀"
-
- print-utf8 -l "😀 Test 😀"
-
- print-utf8 -w "😀 Test 😀"
-
- print-utf8 -a "😀 Test 😀"
-
- print-utf8 --terminal-info
-
- print-utf8 -n -s "\e[1;34m╔" "═"
"╗\e[0m" ;
-
date +"%d. %m. %Y %H:%M:%S" | figlet -w 128 | \
print-utf8 -n -C "\e[1;34m║🕑\e[1;31m"
"\e[1;34m🕑║\e[0m" ;
print-utf8 -n -s "\e[1;34m╚" "═"
"╝\e[0m"
- print-utf8 -n -s "\e[1;31;5m█" "▀"
"█\e[0m" ;
- echo "ERROR 1234" | figlet -w 128 | print-utf8 -n -C
"\e[1;31;5m█\e[25m"
"\e[5m█\e[0m" ;
print-utf8 -n -s "\e[1;31;5m█" "▄"
"█\e[0m"
- print-utf8 -n -s "\e[1;31;40;5m█" "▀"
"█\e[0m" ;
-
echo -e "Software Failure. Press left mouse button to continue.\nGuru
Meditation #00000004.48454C50" | \
print-utf8 -n -C "\e[1;31;40;5m█\e[25m"
"\e[5m█\e[0m" ;
print-utf8 -n -s "\e[1;31;40;5m█" "▄"
"█\e[0m"
- print-utf8 -n -x 44 -s "\e[1;32m╒" "═"
"╕\e[0m" ;
-
ls / | print-utf8 -n --multiline-indent -42
"\e[1;32m│\e[34m"
"\e[1;32m│\e[0m" ;
print-utf8 -n -x 44 -s "\e[1;32m╘" "═"
"╛\e[0m"