ivanceras / svgbob

Convert your ascii diagram scribbles into happy little SVG
http://ivanceras.github.io/svgbob-editor/
Apache License 2.0
3.91k stars 112 forks source link

Add svgbob binary #4

Closed jonhoo closed 8 years ago

jonhoo commented 8 years ago

The current setup builds a binary called main, which is hard-coded to produce the SVG shown on the project's website. This patch instead exposes a binary called svgbob, which reads a bob file from stdin or from a file, and produces an SVG either on stdout or to a file. cargo install builds and exposes things binary. This fixes #3.

svgbob normally operates on stdin and stdout:

$ svgbob < examples/long.bob > long.svg

produces an SVG in long.svg similar to the one produced by the old main binary. svgbob also allows passing arguments instead:

$ svgbob examples/long.bob -o long.svg

And you can mix and match:

$ svgbob -o long.svg < examples/long.bob
$ svgbob examples/long.bob > long.svg

This is also documented in the output of svgbob --help:

$ svgbob --help
svgbob 0.1.2
SvgBobRus is an ascii to svg converter

USAGE:
    svgbob [OPTIONS] [input]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -o, --output <output>    where to write svg output [default: STDOUT]

ARGS:
    <input>    svgbob text file to parse [default: STDIN]

The version is automatically extracted from the crate version (which should probably be bumped after merging this).

ivanceras commented 8 years ago

Thank you Jon.

jonhoo commented 8 years ago

Happy to help!