Skip to content
/ n-cli Public

A bundle of tools to develop node commandline applications

License

Notifications You must be signed in to change notification settings

s-a/n-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
s-a
Jul 17, 2024
891ab90 · Jul 17, 2024

History

88 Commits
Sep 10, 2016
Jul 17, 2024
Jul 11, 2017
Sep 9, 2016
Sep 9, 2016
Sep 9, 2016
Jul 11, 2017
Sep 9, 2016
Oct 11, 2016
Sep 9, 2016
Jul 11, 2017
Oct 12, 2016
Oct 12, 2016
Sep 9, 2016
Jul 11, 2017
Oct 12, 2016
Jul 17, 2024
Jul 17, 2024

Repository files navigation

n-cli NPM version Build Status Dependency Status Coverage Status Donate

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, // beautifies error output to console
  handledRejectionPromiseError : true, // beautifyies error output to console
  runcom : ".myapprc"
});

cli.on("unicorn", function(){
    this.argv.notNull("rainbow");
    this.log(this);
});

cli.runcom(function(rc){ 
    this.log(rc);
});
$ 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.

Build in functions

ncli adds automatically some methods to your commandline application.

# output your version number
$ your-client-app -v;

Output COMMANDLINE-ARGUMENTS.md in your projects root folder

$ your-client-app help;

Help Demo

API

Demo

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

License

MIT © s-a

About

A bundle of tools to develop node commandline applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published