github-markdown-css/cli.js

34 lines
518 B
JavaScript
Raw Permalink Normal View History

2014-05-08 02:02:46 +08:00
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
2014-08-19 07:14:43 +08:00
var githubMarkdownCss = require('./');
var argv = process.argv.slice(2);
2014-05-08 02:02:46 +08:00
function help() {
2014-08-19 07:14:43 +08:00
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' github-markdown-css > <filename>'
].join('\n'));
2014-05-08 02:02:46 +08:00
}
2014-08-19 07:14:43 +08:00
if (argv.indexOf('--help') !== -1) {
2014-05-08 02:02:46 +08:00
help();
return;
}
2014-08-19 07:14:43 +08:00
if (argv.indexOf('--version') !== -1) {
2014-05-08 02:02:46 +08:00
console.log(pkg.version);
return;
}
githubMarkdownCss(function (err, css) {
if (err) {
throw err;
}
console.log(css);
});