New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

oh-command

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oh-command

A nodejs commmands wrapper for convenience.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

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 oh-command -g

adding .oh-command.json config file

{
  "root": "",
  "commands": [
    {
      "name": "build",
      "aliases": [ "b" ],
      "options": [
        { "name": "module", "type": "String", "description": "Specifies module to build." },
        { "name": "all", "type": "Boolean", "description": "Build all modules." }
      ],
      "description": "Builds source code and places it into the output path."
    },
    {
      "name": "serve",
      "aliases": [ "s" ],
      "options": [
        { "name": "module", "type": "String" }
      ]
    }
  ],
  "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

Keywords

command

FAQs

Package last updated on 19 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts