Skip to content

Instantly share code, notes, and snippets.

@mattrothenberg
Created February 2, 2017 20:48
Show Gist options
  • Save mattrothenberg/fddbd52296a93a17da5f308cdd8c2aad to your computer and use it in GitHub Desktop.
Save mattrothenberg/fddbd52296a93a17da5f308cdd8c2aad to your computer and use it in GitHub Desktop.
Runway CLI Step #3
#!/usr/bin/env node
var program = require('commander');
var colors = require('colors');
var Spinner = require('cli-spinner').Spinner;
var spinner = new Spinner('Hot damn, those are some nice styles! Hang tight while we set up your styleguide... %s');
spinner.setSpinnerString('|/-\\');
program
.command('new-styleguide <stylesheet>')
.description('Creates a new Runway styleguide, given a .CSS or .SCSS file. Returns the URL to your styleguide.')
.action(newStyleguide);
function generateRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
function newStyleguide(cmd) {
var randomStyleguideId = generateRandomNumber(1000, 2000);
var styleguideUrl = `http://runway-app.cfapps.io/styleguide/${randomStyleguideId}`;
spinner.start();
setTimeout(function() {
spinner.stop();
console.log('\n' + 'Success!'.green);
console.log(styleguideUrl.underline);
}, 2000);
}
program.parse(process.argv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment