Permalink
Browse files

vash(1) --helpers <file>

A file can be passed in, and thus when paired with --render, can enable
helpers via command line. A complex example:

	cat myTpl.vash | bin/vash --render --helpers \
		<(cat helpers/* | bin/vash --helper)

This example grabs all the files in the helpers directory, compiles them
as helpers, and then passes them as a temporary named pipe into another
call to vash(1) that is rendering myTpl.vash.
  • Loading branch information...
1 parent 47ec274 commit 349a604288f1986fa84c3697e78a22dd2bbfaf7c @kirbysayshi committed Feb 3, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 bin/vash
View
@@ -145,13 +145,19 @@ cli
//.option('-d, --prepend-runtime', 'Include the required Vash runtime')
.option('-r, --render [json]', 'Render the template using <json> as the model')
.option('-s, --separator [separator]', 'Templates are auto-named by concatenating the file path with [separator]', '/')
- .option('-e, --helper', 'Assume the input is a to-be-compiled helper')
+ .option('--helper', 'Assume the input is a to-be-compiled helper')
+ .option('--helpers <file>', 'Execute these compiled helpers')
.parse(process.argv)
if( cli.json ){
cli.vopts = JSON.parse(cli.json);
}
+// helpers via .toClientString, therefore vash.link
+if( cli.helpers ){
+ eval(fs.readFileSync(cli.helpers, 'utf8'));
+}
+
if(cli.file){
cli.file = path.normalize( cli.file )
// assume file input

0 comments on commit 349a604

Please sign in to comment.