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

cliy

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cliy

Command Line Interface Library

  • 3.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Cliy

Command Line Interface Library. example

Features

  • Configuration based API
  • Auto created help menus

Example

#!/usr/bin/env node
const Cliy = require('./index');
const Package = require('./package');

(async function() {

	const program = new Cliy();

	await program.setup({
		name: Package.name,
		version: Package.version,
		operations: [
			{
				key: 'a',
				name: 'one',
                description: 'I am an Operation',
                options: [
                    'opt1',
                    { name: 'opt2', description: 'I am an Option' },
                ],
                async handler (options, results, parameters) {
                    console.log(`a options: ${JSON.stringify(values)}`);
                    console.log(`a results: ${JSON.stringify(results)}`);
                    console.log(`a parameters: ${JSON.stringify(parameters)}`);
					return 'one';
				},
				operations: [
					{
						key: 'b',
						name: 'two',
                        async handler (options, results, parameters) {
                            console.log(`b options: ${JSON.stringify(options)}`);
                            console.log(`b results: ${JSON.stringify(results)}`);
                            console.log(`b parameters: ${JSON.stringify(parameters)}`);
							return 'two'
						}
					}
				]
			}
		]
	});

	await program.run(process.argv);

}()).catch(console.error);

API

  • name: String (default: program)
  • version: String (default: 0.0.0)
  • operations: Array
    • operation: Object
      • key: String
      • name: String
      • description: String
      • options: Array<String,Object>
      • operations: Array<Object>
      • handler: AsyncFunction
        • options: Object An object of name value pairs generated from the arguments following an operation.
        • results: Object An object of name value pairs generated from the returned results from an operation.
        • parameters: Array The remaining arguments from an operation.
  • setup: AsyncFunction
    • options: Object
  • has: AsyncFunction
    • data: String Name or key
  • find: AsyncFunction
    • data: String Name or key
  • add: AsyncFunction
    • operation: Object
  • execute: AsyncFunction
    • operations: Array
      • operation: Object
  • run: AsyncFunction
    • arguments: process.argv
  • log: Function Will print to console with color and style.
    • text: String
    • colors: Array
  • info: Function Will print to console with color and style. (Default color green)
    • text: String
    • colors: Array
  • warn: Function Will print to console with color and style. (Default color yellow)
    • text: String
    • colors: Array
  • error: Function Will print to console with color and style. (Default color red)
    • text: String
    • colors: Array

Colors

  • Style
    • reset
    • bold
    • dim
    • italic
    • underline
    • blink
    • inverse
    • hidden
    • strike
  • Foreground
    • black
    • red
    • green
    • yellow
    • blue
    • magenta
    • cyan
    • white
    • gray
    • grey
  • Background
    • bgBlack
    • bgRed
    • bgGreen
    • bgYellow
    • bgBlue
    • bgMagenta
    • bgCyan
    • bgWhite

Authors

Vokeio

License

Why You Should Choose MPL-2.0 This project is licensed under the MPL-2.0 License

Keywords

FAQs

Package last updated on 30 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