Git Product home page Git Product logo

diagram's Introduction

Diagram

Build Status GoDoc

Diagram is a CLI tool to generate ASCII art from hand drawn diagrams.

It's a full fledged CLI application which converts the ASCII text into a hand drawn diagram. The CLI part is based on gocui package.

screencast

Installation

In order to run the application please make sure that Go is installed on your local machine and check if $GOPATH/bin is included into the PATH directory.

$ export GOPATH="$HOME/go"
$ export PATH="$PATH:$GOPATH/bin"

Download the library

$ go get -u -f github.com/esimov/diagram
$ go install

# Start the application
$ diagram

Prior checking the generated output by invoking the visualization command (with CTRL-d) please make sure that glfw is installed on your local machine.

For a full list of the required external dependencies check the official documentation of go-glfw (https://github.com/go-gl/glfw/blob/master/README.md).

Build

A shell script is bundled into the library to mitigate the generation of binary files for the most widespread operating systems, but take care: different dependencies are needed for different operating systems. To build the executable file run:

$ make all

Usage

Once you are inside the terminal application you can create, edit or delete the ASCII diagrams. By pressing CTRL+d you can convert the ASCII art into a handwritten diagram. The generated PNG file will be saved into the output folder relative to the current path.

Command Line support

The application also supports the generation of hand drawn diagrams directly from command line without to enter into the CLI application.

$ diagram --help will show the currently supported options:

┌┬┐┬┌─┐┌─┐┬─┐┌─┐┌┬┐
 │││├─┤│ ┬├┬┘├─┤│││
─┴┘┴┴ ┴└─┘┴└─┴ ┴┴ ┴
    Version: 1.0.4

CLI app to convert ASCII arts into hand drawn diagrams.

  -font string
    	Path to the font file (default "/Users/esimov/Projects/Go/src/github.com/esimov/diagram/font/gloriahallelujah.ttf")
  -in string
    	Source
  -out string
    	Destination
  -preview
    	Show the preview window (default true)

CLI Examples

Read input from sample.txt and write image to sample.png showing a preview window with the hand drawn diagram:

diagram -in sample.txt -out sample.png

Read input from sample.txt and write image to sample.png, and exit immediately without showing a preview window:

diagram -in sample.txt -out sample.png -preview=false

Generate diagram as above but use a font at a different location:

diagram -in sample.txt -out sample.png -preview=false -font /path/to/my/font/MyHandwriting.ttf

Key bindings

Key Action
Tab Next Panel
Shift+Tab Previous Panel
Ctrl+s Open Save Diagram Modal
Ctrl+s Save Diagram
Ctrl+d Convert Ascii to PNG
Ctrl+x Clear the editor content
Ctrl+z Restore the editor content
PageUp Jump to the top
PageDown Jump to the bottom
Home Jump to the line start
End Jump to the line end
Delete/Backspace Delete diagram
Ctrl+c Quit

Example

Input Output

The application was tested only on Ubuntu and MacOS.

Acknowledgements

The ascii to png conversion was ported from shaky.dart.

Dependencies

Author

License

Copyright © 2017 Endre Simo

This project is under the MIT License. See the LICENSE file for the full license text.

diagram's People

Contributors

esimov avatar mmurphy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.