Skip to main content
https://travis-ci.org/hirokiky/genaa.png?branch=master

genaa is a command line tool for generating ASCII Art:

  +-----+   +---+   +-----+     +-----+   +-----+
  |     |   |   |   |     |     |     |   |     |
+-+---+ | +-+   +-+ | +---+-+ +-+---+ | +-+---+ |
| |   | | |       | | |   | | | |   | | | |   | |
| |   | | | +-----+ | |   | | | |   | | | |   | |
| |   | | | |       | |   | | | |   | | | |   | |
+-+---+ | +-+-----+ | |   | | +-+---+ | +-+---+ |
  |     |   |     | | |   | |   |     |   |     |
  +---+ |   +-----+ +-+   +-+   +-----+   +-----+
      | |
  +---+-+
  |   |
  +---+

Install

Install genaa by using pip.

pip install genaa

Now genaa is supporting Python 2.7 and 3.3.

Basic Usage

genaa has some sub-commands to render various ASCII Arts:

  • box

  • block

genaa box is the most basic and simple feature. It can render a block containing text input by user:

$ genaa box --text Hello!
+--------+
| Hello! |
+--------+

genaa block is a command to render some free shape blocks. It takes some ‘dots’ and translate it to ASCII Art blocks. This example show you how to create a well-known TETRIS block from command line:

$ genaa block --text '
> ***
>  * '

+-----+
|     |
+-+ +-+
  | |
  +-+

As filter

Above examples are used as one of simple command line tools, using –text argument. But, genaa usually behaves as a filter command, like this:

$ echo -en 'Hello world!\nThis is genaa' | genaa box
+---------------+
| Hello world!  |
| This is genaa |
+---------------+

Generally, it is recommended to use from some editors. Most editors has a feature to pass the selected text to some shell command and input returned value. On Emacs, you can use ‘shell-command-on-region’.

genaa box

You can specify these arguments to genaa box:

-h, --help            show this help message and exit
-t TEXT, --text TEXT  Passing text by argument into box
-W WIDTH, --width WIDTH
-H HEIGHT, --height HEIGHT
-s {ccomment,ascii,hash,simple}, --style {ccomment,ascii,hash,simple}
-l, --list            Displaying examples for each styles

–width and –height

By default, genaa box command render the box with automatically specified width/height. But, you can specify these width and height of the box manually, like this:

$ echo -en 'Hello world!\nThis is genaa' | genaa box --width=20 --height=3
+----------------------+
| Hello world!         |
| This is genaa        |
|                      |
+----------------------+

–style

This example is using hash style which is used as comment block in Python:

$ echo -en 'Hello world!\nThis is genaa' | genaa box --style=hash
#################
# Hello world!  #
# This is genaa #
#################

–list

The list of styles are on genaa box –list command:

$ genaa box --list
ascii:
+-----------------------+
| Hello.                |
| How about this style? |
+-----------------------+

ccomment:
/************************
* Hello.                *
* How about this style? *
************************/

hash:
#########################

–align

genaa box command put the text at the left side of the box. It also supports putting the text on center and right:

genaa box --align=center --text=Hello --width=20
+----------------------+
|        Hello         |
+----------------------+

genaa block

You can specify these arguments to genaa block:

-h, --help            show this help message and exit
-t TEXT, --text TEXT  Passing text by argument into block
-s {ascii,simple}, --style {ascii,simple}
-l, --list            Displaying examples for each styles

–style

This example is using simple style. You can see this clearly by some mono-space fonts:

$ genaa block --style=simple
**
* *
 *
┌───┐
│   │
│ ┌─┼─┐
│ │ │ │
└─┼─┼─┘
  │ │
  └─┘

–list

The list of styles are on genaa block –list command:

$ genaa block --list
ascii:
  +-+
  | |
  +-+-+   +-+ +-+       +-+   +-+       +-+
    | |   | | | |       | |   | |       | |
+---+ |   +-+-+ |   +-+ | |   +-+---+   +-+-+
|     |     |   |   | | | |     |   |     | |
+-----+     | +-+   +-+-+ |   +-+ +-+ +---+ |
            | |       |   |   |   |   |     |
            +-+       +---+   +---+   +-----+

simple:
  ┌─┐
  │ │
  └─┼─┐   ┌─┐ ┌─┐       ┌─┐   ┌─┐       ┌─┐
    │ │   │ │ │ │       │ │   │ │       │ │
┌───┘ │   └─┼─┘ │   ┌─┐ │ │   └─┼───┐   └─┼─┐

Changes

0.4 (2013-1-17)

Multi-width characters support (like japanese)

0.3 (2013-1-12)

Python2 support (2.7 only)

0.2 (2013-1-3)

Added genaa block command. Added –list argument to genaa box.

0.1 (2013-12-28)

Initial release. Supporting:

  • Rendering boxes with text

    • Auto specifying width and height

    • Changing style of boxes

    • Align specifying (right, center, left)

Metadata

Release files for genaa 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genaa 0.4
File Size Uploaded
genaa-0.4.tar.gz 11.1 kB Details

Release files / genaa-0.4.tar.gz

Download URL genaa-0.4.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6ba9263737df4ee49957e4c00dc8214d4a5d2099a05c9e20f355ec00b8274c84
BLAKE2b-256 checksum
How to use checksums
fe0d27975275740d5b2e3a2afa12a278b551a561d26a442bc74f10df972f4821
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page