New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

n-cli

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n-cli

a usefull toolset for node commandline applications

  • 1.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

n-cli NPM version Build Status Dependency Status Coverage Status

a usefull toolset for node commandline applications

Installation

$ npm install --save n-cli

Usage

#!/usr/bin/env node

"use strict";

var Cli = new require("n-cli");
var cli = new Cli({
  silent: false,
  handleUncaughtException : true
});

cli.on("unicorn", function(){
    this.argv.notNull("rainbow");
    this.log(this);
});
$ your-client-app unicorn --rainbow forever;

# yields :
{
  prettyError:
   PrettyError { },
  init:
   { appname: 'node-cli-example-app-1',
     handleUncaughtException: true },
  argv: { _: [ 'unicorn' ], rainbow: 'e', notNull: [Function: bound ] },
  config:
   { settings: {},
     appFolder: 'c:\\git\\n-cli\\examples',
     appPackageFilename: 'c:\\git\\n-cli\\examples\\package.json',
     appPackage: {},
     appName: 'node-cli-example-app-1',
     dataFolder: 'C:\\Users\\User\\AppData\\Roaming\\node-cli-example-app-1',
     filename: 'C:\\Users\\User\\AppData\\Roaming\\node-cli-example-app-1\\config.json' },
  color:
   Chalk { },
  Error: [Function: NodeCliError],
  minimist: [Function]
}
$ your-client-app unicorn --rainbow ;

# yields : missing-parameter-value missing value for parameter rainbow.

Demo

https://www.youtube.com/watch?v=m53SlSaP6cs

License

MIT © s-a

API

CLI

Members:


CLI(config)

Parameters

config: object, configuration.

Example:

var cli = new CLI({
  silent: false,
  handleUncaughtException : true
})

CLI.resolvePath(fileOrDir)

Resolve a path

Parameters

fileOrDir: string, Filename or directory

Returns: string, Absolute directory name relative to the current working directory of process.

CLI.findup(basedir, filename)

Find a file in parent directories.

Parameters

basedir: string, In most cases the current directory of process.

filename: string, Filename to find.

Returns: string, Absolute directory to given filename.

CLI.programInfo()

Output program informations based on package.json to console.

CLI.on(commandName, commandFunction)

Catch a commandline switch case. The commandFunction runs in context of CLI.

Parameters

commandName: string, A command you want to process. For example push or commit.

commandFunction: function, An event handler function.

CLI.silent()

Determines of console app is running in silent mode. Silent mode activates automaticaly when process.env.NODE_ENV === "test".

CLI.log()

Like console.log put implements util.inspect.

CLI.error()

Like console.error put implements util.inspect.

CLI.stdout()

Wrapper for process.stdout.write

CLI.stderr()

Wrapper for process.stderr.write


Keywords

FAQs

Package last updated on 06 Oct 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc