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

@absolunet/cli

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@absolunet/cli

CLI utilities

  • 0.9.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

@absolunet/cli

npm npm dependencies npms Travis CI Code style ESLint

CLI utilities

Built around meow

Install

$ npm install @absolunet/cli

Usage

const cli = require('@absolunet/cli');

cli.initTasksList('./tasks');

cli.setUsageTasks({

	// Base
	'start': ['start', 'Start project'],
	'stop':  ['stop',  'Stop project'],
	'log':   [`log ${cli.optionalPlaceholder('<sub>')}`, 'Show log for sub', ['sub1', 'sub2']],

	// Options
	'--help':    ['-h, --help',    'Show help'],
	'--version': ['-v, --version', 'Show version']

});

cli.setFullUsage({
	'Base':    ['start', 'stop', 'log'],
	'Options': ['--help', '--version']
});

console.log(cli.fullUsage);
	Test project description

	Usage: testprj <command>

	Base
	start             Start project
	stop              Stop project
	log [<sub>]       Show log for sub [sub1|sub2]

	Options
	-h, --help        Show help
	-v, --version     Show version

	testprj@1.2.3 /usr/local/bin/testprj


init([options])

Build tasks list from js filenames

options.pkgPath

Type: string
Path to package.json folder

options.pkg

Type: object
package.json-like object


API - Tasks

initTasksList(tasksPath)

Build tasks list from js filenames

tasksPath

Required
Type: string
Path to tasks folder


tasksRouter(meowCli)

Require task file specified by CLI

meowCli

Required
Type: object
meow object


tasks

Type: Array
List of tasks



API - Usage

placeholder(name)

Look placeholder
Return string of looked placeholder

name

Required
Type: string
Text to theme


optional(name)

Look optional
Return string of looked optional

name

Required
Type: string
Text to theme


optionalPlaceholder(name)

Look optional placeholder
Return string of looked optional placeholder

name

Required
Type: string
Text to theme


setUsageTasks(commands)

Set tasks usage and autocomplete data

commands

Required
Type: object
Check example for structure


setFullUsage(fullUsage [, options])

Set full usage structure

fullUsage

Required
Type: object
Check example for structure

options.showBin

Type: boolean
Show version and bin location
Default: true


getTaskUsage(task)

Get task usage
Return string of task usage

task

Required
Type: string
Check example for structure


showTaskUsage(meowCli)

Display task usage and quit

meowCli

Required
Type: object
meow object


fullUsage

Type: string
Description and tasks formatted as a user manual



API - Helpers

refuseArguments(meowCli)

Show task usage and quit if CLI call has arguments

meowCli

Required
Type: object
meow object


ow

Type: Object
Instance of local ow


refuseFlags(meowCli)

Show task usage and quit if CLI call has flags

meowCli

Required
Type: object
meow object


refuseFlagsAndArguments(meowCli)

Show task usage and quit if CLI call has arguments or flags

meowCli

Required
Type: object
meow object


validateFlags(meowCli, flag)

Show task usage and quit if CLI call has flags that are not whitelisted and do not validate
Return object of flags values

meowCli

Required
Type: object
meow object

flagValidations

Required
Type: object of flag validators
Whitelisted flags and their ow predicate (use cli.ow to ensure to use the same version)


isRoot()

Check if CLI is run by root user
Return boolean


binName

Type: string
Binary name


rawArguments

Type: string
Space separated arguments from terminal



License

MIT © Absolunet

Keywords

FAQs

Package last updated on 22 Jul 2019

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