Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

consultant

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consultant

Library for getting parameters from various sources

  • 0.7.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

consultant

npm version npm download dependencies license

What is the Consultant?

Consultant is a JavaScript library which allows us getting parameters (or options) from various sources such as command line, string or interactive menu.

Provides:

  • Well-defined input model for operations require parameters.
  • Declerative approach.
  • Multiple methods for getting parameter (or options)
    • Parsing command line input like cmd --parameter=value --option1 --option2.
    • Interactive command line user interface to getting options directly from user.
  • Prepares an help output based on model definition.

Example Usage

import consultant from 'consultant';

const rules = {
    makefile: {
        type: String,
        aliases: [ 'f' ],
        label: 'Makefile',
        description: 'Load tasks from FILE',
        parameter: 'FILE',
        'default': [ 'makefile.js' ],
        uiHidden: false,
        min: 0,
        max: undefined,
        validate: (value) => value.length >= 3 || 'minimum 3 chars required'
    },
    tasks: {
        type: Boolean,
        aliases: [ 't' ],
        label: 'Tasks',
        description: 'Lists defined tasks',
        'default': false,
        uiHidden: true,
        min: 0,
        max: 1
    },
    verbosity: {
        type: String,
        label: 'Verbosity',
        description: 'Sets verbosity of log messages [debug, warn, info, error]',
        'default': 'info',
        values: [ 'debug', 'warn', 'info', 'error' ],
        uiHidden: true,
        min: 0,
        max: 1
    },
    version: {
        type: Boolean,
        aliases: [ 'v' ],
        label: 'Version',
        description: 'Displays the jsmake version',
        'default': false,
        uiHidden: true,
        min: 0,
        max: 1
    },
    help: {
        type: Boolean,
        aliases: [ 'h', '?' ],
        label: 'Help',
        description: 'Displays this help message',
        'default': false,
        uiHidden: true,
        min: 0,
        max: 1
    }
};

// string parsing
const input1 = consultant.input.fromString('eser testing --makefile testfile.js');
console.log(input1.validate(rules));

// command line parsing
const input2 = consultant.input.fromCommandLine();
console.log(input2.validate(rules));

// command line user interface
consultant.input.fromInquiry(rules)
    .then((input3) => {
        console.log(input3.validate(rules));
    });

Quick start

Execute npm install consultant to install consultant and its dependencies into your project directory.

Todo List

See GitHub Projects for more.

Requirements

License

Apache 2.0, for further details, please see LICENSE file

Contributing

See contributors.md

It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome.

  • To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
  • To report a bug: If something does not work, please report it using GitHub Issues.

To Support

Visit my patreon profile at patreon.com/eserozvataf

Keywords

FAQs

Package last updated on 29 Jun 2017

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