
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
consultant
Advanced tools
Gathers structural and validateable input from command line or interative menu
Consultant is a JavaScript library which allows you gathering options from various sources such as command line, optstring or interactive menu.
Provides:
cmd --parameter=value --option1 --option2
.Execute npm install consultant
to install consultant and its dependencies into your project directory.
import { Consultant } from 'consultant';
const rules = {
label: 'sample menu',
children: {
plugins: {
type: Consultant.types.command,
aliases: [ 'p' ],
id: 'plugins',
label: 'Plugin commands',
description: 'Add/list plugins',
children: {
add: {
type: Consultant.types.command,
id: 'plugins-add',
label: 'Add',
description: 'Adds a plugin'
},
repo: {
type: Consultant.types.stringParameter,
label: 'Repo',
description: 'Specifies repo address',
'default': 'http://github.com/eserozvataf/',
min: 0,
max: 1
}
}
},
makefile: {
type: Consultant.types.stringParameter,
aliases: [ 'f' ],
label: 'Makefile',
description: 'Load tasks from FILE',
parameter: 'FILE',
'default': [ 'makefile.js' ],
min: 0,
max: undefined,
validate: (value) => value.length >= 3 || 'minimum 3 chars required'
},
tasks: {
type: Consultant.types.booleanParameter,
aliases: [ 't' ],
label: 'Tasks',
description: 'Lists defined tasks',
'default': false
},
verbosity: {
type: Consultant.types.stringParameter,
label: 'Verbosity',
description: 'Sets verbosity of log messages [debug, warn, info, error]',
'default': 'info',
values: [ 'debug', 'warn', 'info', 'error' ],
min: 0,
max: 1
},
version: {
type: Consultant.types.booleanParameter,
aliases: [ 'v' ],
label: 'Version',
description: 'Displays the jsmake version',
'default': false
},
help: {
type: Consultant.types.booleanParameter,
aliases: [ 'h', '?' ],
label: 'Help',
description: 'Displays this help message',
'default': false
}
}
};
const params = new Consultant(rules);
// string parsing
const input1 = await params.fromString('plugins add --makefile testfile.js');
console.log(input1.commandId); // plugins-add
console.log(input1.values.makefile); // [ 'testfile.js' ]
// command line parsing
const input2 = await params.fromCommandLine();
console.log(input2.values.verbosity); // info
// command line user interface
const input3 = await params.fromInquiry();
See GitHub Projects for more.
Apache 2.0, for further details, please see LICENSE file
See contributors.md
It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome.
FAQs
Gathers structural and validateable input from command line or interative menu
The npm package consultant receives a total of 11 weekly downloads. As such, consultant popularity was classified as not popular.
We found that consultant demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.