Skip to content

daniel-lundin/aboxd

Repository files navigation

aboxd

Build Status npm version

Turn comma-separated strings to ascii-charts. Try it live here

img

Examples

npx aboxd 'left,right' will yield:

┌──────┐   ┌───────┐
│ left │───│ right │
└──────┘   └───────┘

npx aboxd $',top\nbottom-left,bottom-right' will yield:

                  ┌──────────────┐
                  │     top      │
                  └──────────────┘
                         │        
┌─────────────┐   ┌──────────────┐
│ bottom-left │───│ bottom-right │
└─────────────┘   └──────────────┘

Use a dot(".") to connect boxes without text:

npx aboxd $'.,top\nbottom-left,bottom-right' will yield:


                  ┌──────────────┐
       ┌──────────│     top      │
       │          └──────────────┘
       │                 │        
┌─────────────┐   ┌──────────────┐
│ bottom-left │───│ bottom-right │
└─────────────┘   └──────────────┘

From files

aboxd will read from stdin if no arguments are given

Given a file:

,Sky
Sweden,Norway
Subway,.

cat file | npx aboxd


             ┌────────┐
             │  Sky   │
             └────────┘
                 │     
┌────────┐   ┌────────┐
│ Sweden │───│ Norway │
└────────┘   └────────┘
    │            │     
┌────────┐       │     
│ Subway │───────┘     
└────────┘             

Vim plugin

Plugin is a stretch, but add this to .vimrc to trigger aboxd on the current selection with <leader>a:

vnoremap <leader>a :!npx aboxd<CR>

LICENSE

MIT Copyright Daniel Lundin