Sunday, February 10, 2013

Simple command line tool via Node.js

Here is the gist of a little script I wrote recently:


It runs on Node, so you'll need that, and npm of course (which installs with Node), you'll also note that you'll need commander, you can ge that by running:
npm instal commander
Once you've got that installed you can use the following to get the usage information:
node concat.js
Which will return
 Usage: concat.js [options]


    -h, --help                output usage information
    -V, --version             output the version number
    -f, --filelist [txtfile]  use an input file with a comma separated list of files to concat
    -s, --files [files]       specify the files to concat in the option
    -d, --dest [dest]         the destination file
So, it's a little script that will take a list of javascript files & concatenate them together. You can provide the list either in a text file or on the command line, and in either case it's a comma separated list of filenames.

Node.js: Node.js
Commander.js: on github

No comments:

Post a Comment