[Seethisblogpost](http://weblog.bocoup.com/building-command-line-tools-in-node-with-liftoff/), [check out this proof of concept](https://github.com/js-cli/js-hacker), or read on.
Sayyou'rewritingaCLItool.Let'scallit[hacker](https://github.com/js-cli/js-hacker). You want to configure it using a `Hackerfile`. This is node, so you install `hacker` locally for each project you use it in. But, in order to get the `hacker` command in your PATH, you also install it globally.
Now,whenyourun`hacker`, you want to configure what it does using the `Hackerfile` in your current directory, and you want it to execute using the local installation of your tool. Also, it'd be nice if the `hacker` command was smart enough to traverse up your folders until it finds a `Hackerfile`—for those times when you're not in the root directory of your project. Heck, you might even want to launch `hacker`fromafolderoutsideofyourprojectbymanuallyspecifyingaworkingdirectory.Liftoffmanagesthisforyou.
So,everythingisworkinggreat.Nowyoucanfindyourlocal`hacker` and `Hackerfile` with ease. Unfortunately, it turns out you've authored your `Hackerfile`incoffee-script,orsomeotherJSvariant.Inordertosupport*that*,youhavetoloadthecompilerforit,andthenregistertheextensionforitwithnode.Goodnews,Liftoffcandothat,andawholelotmore,too.
##API
###constructor(opts)
CreateaninstanceofLiftofftoinvokeyourapplication.
Anexampleutilizingalloptions:
```js
constHacker=newLiftoff({
name:'hacker',
processTitle:'hacker',
moduleName:'hacker',
configName:'hackerfile',
extensions:{
'.js':null,
'.json':null,
'.coffee':'coffee-script/register'
},
v8flags:['--harmony']// or v8flags: require('v8flags')
InthisexampleLiftoffwilllookfor`myappfile{.js,.json,.coffee}`. If a config with the extension `.coffee` is found, Liftoff will try to require `coffee-script/require`fromthecurrentworkingdirectory.
```js
constMyApp=newLiftoff({
name:'myapp',
extensions:{
'.js':null,
'.json':null,
'.coffee':'coffee-script/register'
}
});
```
Inthisexample,Liftoffwilllookfor`.myapp{rc}`.
```js
constMyApp=newLiftoff({
name:'myapp',
configName:'.myapp',
extensions:{
'rc':null
}
});
```
Inthisexample,Liftoffwillautomaticallyattempttoloadthecorrectmoduleforanyjavascriptvariantsupportedby[node-interpret](https://github.com/tkellen/node-interpret) (as long as it does not require a register method).
```js
constMyApp=newLiftoff({
name:'myapp',
extensions:require('interpret').jsVariants
});
```
####opts.v8flags
Anyflagspecifiedherewillbeappliedtonode,notyourprogram.Usefulforsupportinginvocationslike`myapp --harmony command`, where `--harmony`shouldbepassedtonode,notyourprogram.Thisfunctionalityisimplementedusing[flagged-respawn](http://github.com/tkellen/node-flagged-respawn). To support all v8flags, see [node-v8flags](https://github.com/tkellen/node-v8flags).
__Note:__Thisoptionisusefulif,forexample,youwanttosupportan`.apprc` file in addition to an `appfile.js`.Ifyouonlyneedasingleconfigurationfile,youprobablydon'tneedthis.Inadditiontolettingyoufindmultiplefiles,thisoptionallowsmorefine-grainedcontroloverhowconfigurationfilesarelocated.
Type:`Object`
Default:`null`
####Patharguments
The[`fined`](https://github.com/js-cli/fined) module accepts a string representing the path to search or an object with the following keys: