RubyGems Navigation menu

pipetext 0.2.2

Easily add colors, boxes, repetitions and emojis to your terminal output using pipes (|).

Install using the Ruby Gem:

> gem install pipetext

Includes a Ruby library module which can be included in your code:

require 'pipetext'

class YellowPrinter
  include PipeText
  def print(string)
    write('|Y' + string + '|n')
  end
end

printer = YellowPrinter.new
printer.print('This is yellow')

The gem includes a command line interface too:

> pipetext

> pipetext '|Ccyan|n'

Works with files:

> pipetext <filename>

Works with pipes too:

> echo '|RRed test |u1f49c|n' | pipetext

| pipe  ||  & ampersand    &&  Toggle (&) background color mode  |&
smoke   |s  white          |W  black text on white background    |k&w
red     |r  bright red     |R  red background      &r
green   |g  bright green   |G  green background    &g
blue    |b  bright blue    |B  blue background     &b
cyan    |c  bright cyan    |C  cyan background     &c
yellow  |y  bright yellow  |Y  yellow background   &y
magenta |m  bright magenta |M  magenta background  &m

Hex RGB color codes:    Foreground |#RRGGBB  Background      &#RRGGBB
Palette colors (256) using Hex:    |p33&pF8  Clear Screen    |!
black with white background        |K&w      Blinking        |@
white with magenta background      |w&m      invert          |i
smoke with green background        |s&g      Underlined      |_
red with cyan background           |r&c      Italics         |~
bright red with blue background    |R&b      Bold            |+
green with yellow background       |g&y      Faint           |.
bright green with red background   |G&r      Crossed out     |x
normal color and background        |n&n      Escape Sequence |\

Center text using current position and line end number       |{text to center}
Add spaces to line end             |;         Set line end   |]#
Set current x,y cursor position    |[x,y]     Terminal bell  |[bell]
Move cursor up 1 line              |^         Hide cursor    |h
Move cursor down 1 line            |v         Unhide cursor  |H
Move cursor forward 1 character    |>         Sleep timer in seconds      |[#s]
Move cursor back 1 character       |<         Sleep timer in milliseconds |[#ms]
Capture variable  |(variable name=data)       Display variable        |(variable name)
Add to variable   |(variable name+=data)      Subtract from variable  |(variable name-=data)
Multiple variable |(variable name*=data)      Divide variable         |(variable name/=data)
Copy variable to current number    |(#variable name)

Emojis:  https://unicode.org/emoji/charts/full-emoji-list.html
       |[Abbreviated CLDR Short Name]     ๐Ÿ˜ |[smiling face with heart-eyes] or
    โš™  |[gear]   ๐Ÿ’ค |[zzz]   ๐Ÿ‘จ |[man]    ๐Ÿ˜ |[sm f w he e]
    โœ”  |U2714    โŒ |U274c    โ˜ฎ |u262E    ๐Ÿ’Ž |u1f48e    ๐Ÿ’œ |u1f49c

Single or double line box mode with |- or |=

               โ”Œโ”€โ”€โ”ฌโ”€โ”€โ” โ•”โ•โ•โ•ฆโ•โ•โ•— +--+--+  <-- Draw this with this:  |15 |-[--v--] |=[--v--] |o[--v--]
               โ”‚  โ”‚  โ”‚ โ•‘  โ•‘  โ•‘ |  |  |                            |15 |-!  !  ! |=!  !  ! |o!  !  !
123456789012345โ”œโ”€โ”€โ”ดโ”€โ”€โ”ค โ• โ•โ•โ•ฉโ•โ•โ•ฃ +--+--+           |y1234567890|g12345|n|->--^--< |=>--^--< |o>--^--< 
15 Spaces      โ”‚     โ”‚ โ•‘     โ•‘ |     |                |c15|n Spaces|6 |-!     ! |=!     ! |o!     !
(|15 )         โ””โ”€โ”€โ”€โ”€โ”€โ”˜ โ•šโ•โ•โ•โ•โ•โ• +-----+                      (||15 )|9 |-{-----} |={-----} |o{-----}

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—            |-[|18-]|4 |g&m|=[|20-]|n&n|O
โ”‚                  โ”‚    โ•‘                    โ•‘            |-!|18 !|4 |g&m|=!|20 !|n&n|O
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค    โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ            |->|18-<|4 &m|g|=>|20-<|n&n|O
โ”‚                  โ”‚    โ•‘                    โ•‘            |-!|18 !|4 |g&m|=!|20 !|n&n|O
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•            |-{|18-}|4 |g&m|={|20-}|n&n|O

Repetition using | followed by the number of characters to repeat and then the character to repeat.
|15* does the * character 15 times like this: ***************

Use the pipetext command to see other options and examples.

Gemfile:
=

install:
=

Versions:

  1. 0.2.2 November 28, 2025 (30.5 KB)
  2. 0.2.1 November 28, 2025 (30.5 KB)
  3. 0.2.0 November 27, 2025 (30 KB)
  4. 0.1.6 November 25, 2025 (29.5 KB)
  5. 0.1.5 November 23, 2025 (29.5 KB)
Show all versions (22 total)

Owners:

Pushed by:

Authors:

  • Minaswan Nakamoto

SHA 256 checksum:

=

Total downloads 3,146

For this version 129

Version Released:

License:

MIT

Required Ruby Version: >= 1.8.7

Links: