Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 1.18 KB

File metadata and controls

79 lines (53 loc) · 1.18 KB

Victor CLI

repocard

Command line interface for Victor, the SVG Library.

Installation

$ gem install victor-cli

Usage

init: Create a sample Ruby file

Run this command to create an initial sample file:

$ victor init example

render: Render Ruby to SVG

Given this Ruby code:

# example.rb
setup width: 140, height: 100

# allow changing parameters from the command line
color = params[:color] || :yellow

build do
  circle cx: 50, cy: 50, r: 30, fill: color
end

Run this command:

$ victor render example.rb --template minimal color=blue

To generate this code:

<svg width="140" height="100">
  <circle cx="50" cy="50" r="30" fill="blue"/>
</svg>

convert: Convert SVG to Ruby

Given this SVG file:

<!-- example.svg -->
<svg width="140" height="100">
  <circle cx="50" cy="50" r="30" fill="yellow"/>
</svg>

Run this command:

$ victor convert example.svg

To generate this Ruby code:

setup width: 140, height: 100

build do
  circle cx: 50, cy: 50, r: 30, fill: "yellow"
end