Skip to content

Generate different forms inside the terminal like a message, menu or table.

License

Notifications You must be signed in to change notification settings

DKNorad/blue-terminal-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blue Terminal Generator

Easily create messages, menus or directly visualize table data into the terminal

How to use

Message

from bluetermgen.message import Message

message = Message("Hello World")
print(message)
┌───────────┐
│Hello World│
└───────────┘

Menu

from bluetermgen.menu import Menu

menu = Menu(
    menu_items=["Option 1", "Option 2", "Option 3"],
    header="Main Menu",
    footer="0) Exit",
    index="number_parentheses"
    )
print(menu)
┌───────────┐
│Main Menu  │
├╌╌╌╌╌╌╌╌╌╌╌┤
│1) Option 1│
│2) Option 2│
│3) Option 3│
├───────────┤
│0) Exit    │
└───────────┘

Table

Table data is a list of dictionaries. The keys are used for the column headers.

from bluetermgen.table import Table

table = Table(
    [
        {"name": "John", "age": 25, "city": "New York",},
        {"name": "Jane", "age": 30, "city": "San Francisco",},
        {"name": "Bob", "age": 40, "city": "Los Angeles",},
        {"name": "Alice", "age": 35, "city": "Chicago",},
    ],
)
print(table)
┌─────┬───┬─────────────┐
│name │age│city         │
├╌╌╌╌╌┼─╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│John │25 │New York     │
│Jane │30 │San Francisco│
│Bob  │40 │Los Angeles  │
│Alice│35 │Chicago      │
└─────┴───┴─────────────┘

Table data is a list of lists. The first list is used for the column headers. Data order is CSV like.

from bluetermgen.table import Table

table = Table(
    [
        ["Header1", "Header2", "Header3"],
        ["Row1_c1", "Row1_c2", "Row1_c3"],
        ["Row2_c1", "Row2_c2", "Row2_c3"],
        ["Row3_c1", "Row3_c2", "Row3_c3"],
    ],
)
print(table)
┌───────┬───────┬───────┐
│Header1│Header2│Header3│
├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
│Row1_c1│Row1_c2│Row1_c3│
│Row2_c1│Row2_c2│Row2_c3│
│Row3_c1│Row3_c2│Row3_c3│
└───────┴───────┴───────┘

About

Generate different forms inside the terminal like a message, menu or table.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages