New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

amiral

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amiral

Command line tool

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

Amiral

Command line tool

Installation

npm i -S amiral

Dependencies

  • Chalk
  • Commander
  • Fractale
  • Inquirer

Usage

// my_module/bin/index.js
'use strict';

const Amiral = require('amiral');
const program = require('commander');
const path = require('path');
const { version } = require(path.resolve(__dirname, '..', 'package.json'));

const child_process = require('child_process');

Amiral.create({
    name: 'cowsay',
    description: 'Cow say some text',
    fields: [{
        name: 'content',
        label: 'What say the cow',
        required: false,
        argument: true,
    }, {
        name: 'file',
        label: 'What kind of cow',
        required: false,
        default: 'tux',
    }],
}).then((props) => {
    return child_process.spawn('cowsay', ['-f', props.file, props.content], { stdio: 'inherit' });
});

program.version(version, '-v, --version').parse(process.argv);

Schema

Command
const CommandSchema = {
    name: String,               // Command name used to be called in cli
    description: String,        // Command description used in help message
    help: String,               // Help message showing after command usage and options
    master: Boolean,            // Specify if command is the master command
    fields: [Field],            // Property that can be passed to command or prompted
}
Field
const FieldSchema = {
    label: String,              // Label used in question and field description
    name: String,               // Name of the field
    type: undefined,            // Specify the field type (Boolean, Number, String, Object, Array, Map)
    required: Boolean,          // Specify if the field is required
    default: undefined,         // Default value
    value: undefined,           // Stored value (filled automatically)
    children: [Fractale.SELF],  // Children 

    // Command specific
    shortcut: String,           // Command shortcut
    argument: Boolean,          // Specify if field is command argument

    // Question specific
    question: String,           // Inquirer question type
    message: String,            // Override label for question
    pageSize: Number,
    prefix: String,
    suffix: String,
    choices: undefined,
    filter: undefined,
    transformer: undefined,
    validate: undefined,
    when: undefined,
}

FAQs

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