Better docs for rhtmlc

This commit is contained in:
Patrick Steele-Idem 2014-03-26 17:10:07 -06:00
parent 4ff4b0b506
commit 942550eaf3
2 changed files with 89 additions and 67 deletions

View File

@ -1,26 +1,46 @@
var raptorTemplatesCompiler = require('../compiler');
var glob = require("glob");
var optimist = require('optimist');
var fs = require('fs');
var globPatterns;
var raptorPromises = require('raptor-promises');
var argv = optimist
.alias('n', 'name')
.describe('n', 'The name of the page being optimized (e.g. "my-page")')
.usage('Usage: $0 <pattern> [options]\nExamples:\n' +
' Compile a single template:\n' +
' $0 rhtml template.rhtml\n\n' +
' Compile all templates in the directory tree:\n' +
' $0 rhtml **/*.rhtml')
.check(function(argv) {
if (!argv._) {
throw '';
var argv = require('raptor-args').createParser({
'--help': {
type: 'boolean',
description: 'Show this help message'
},
'--templates --template -t *': {
type: 'string[]',
description: 'The path to a template to compile'
}
})
.argv;
.usage('Usage: $0 <pattern> [options]')
.example('Compile a single template', '$0 rhtml template.rhtml')
.example('Compile all templates in the directory tree', '$0 rhtml **/*.rhtml')
.validate(function(result) {
if (result.help) {
this.printUsage();
process.exit(0);
}
globPatterns = argv._;
if (!result.templates || result.templates.length === 0) {
this.printUsage();
process.exit(1);
}
})
.onError(function(err) {
this.printUsage();
if (err) {
console.log();
console.log(err);
}
process.exit(1);
})
.parse();
globPatterns = argv.templates;
var found = {};
var promises = [];

View File

@ -35,7 +35,9 @@
"raptor-files": "^0.2.0-beta",
"htmlparser2": "~3.5.1",
"char-props": "~0.1.5",
"raptor-promises": "^0.2.0-beta"
"raptor-promises": "^0.2.0-beta",
"glob": "^3.2.9",
"raptor-args": "^0.1.9-beta"
},
"devDependencies": {
"mocha": "~1.15.1",