Skip to content

Commit

Permalink
bitfield.js takes named arguments
Browse files Browse the repository at this point in the history
--input : input JSON filename - must be specified always
--vspace : vertical space - default 80
--hspace : horizontal space - default 640
--lanes : rectangle lanes - default 2
--bits : overall bitwidth - default 32
** by default 2 lanes, 16bit each (total 32bit) rectangles to be generated **
  • Loading branch information
K4zuki committed Nov 19, 2016
1 parent f9e122a commit 45c0e9d
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions bin/bitfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,25 @@ var lib = require('../lib'),

var argv = yargs.count('icestorm').argv;
var fileName;
var options = {
vspace: 80,
hspace: 640,
lanes: 2,
bits: 32
};

if (argv._.length === 1) {
fileName = argv._[0];
if (argv.input){
if (argv.vspace && argv.hspace && argv.lanes && argv.bits){
options = {
vspace: argv.vspace,
hspace: argv.hspace,
lanes: argv.lanes,
bits: argv.bits
};
}
fileName = argv.input;
fs.readJson(fileName, function (err, src) {
var res = lib.render(src);
var res = lib.render(src, options);
var svg = onml.s(res);
console.log(svg);
});
Expand Down

0 comments on commit 45c0e9d

Please sign in to comment.