0.1.1 • Published 8 years ago

oh-commands v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

oh-command

A nodejs commands wrapper for convenience.

Why

If you are using nodejs commands as below,

node ./index.js --command=build --module=myapp

# or via npm scripts
npm run build -- --module=myapp

consider making it more elegant.

Usage

install

npm i title -g

adding .pacman.json config file

{
  "root": "",
  "commands": [
    {
      "name": "build",
      "aliases": ["b"]
    },
    {
      "name": "serve",
      "aliases": ["s"]
    }
  ],
  "entry": "index.js"
}

Now you can use command as follows.

oc build --module=myapp
oc serve --module=myapp

The entry must be a function and the command and arguments will be passed in, for example.

# command
oc build --module=myapp
// entry
module.exports = function(command, commandArgs) {
  console.log(command); // build
  console.log(commandArgs); // { module: "myapp" }
}

License

MIT

0.1.1

8 years ago

0.1.0

8 years ago