@harrytwright/cli-config
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

CLI Config

Beta stage of a new change

A CLI options middleman for nopt

Usage

import Config from '@harrytwright/cli-config';

const types = {
    color: ['always', Boolean],
    host: String,
    loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'],
    password: String,
    port: Number,
    database: String,
    usage: Boolean,
    username: String,
    version: Boolean
}

const defaults = {
    color: process.env.NO_COLOR == null,
    host: 'localhost',
    loglevel: 'notice',
    password: null,
    port: 27017,
    database: null,
    usage: false,
    username: null,
    version: false
}

const config = new Config({ defaults, types })
config.load()

config.get('port') // 27017

Readme

Keywords

Package Sidebar

Install

npm i @harrytwright/cli-config

Weekly Downloads

158

Version

2.0.0

License

ISC

Unpacked Size

15.1 kB

Total Files

11

Last publish

Collaborators

  • harrytwright