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

config-cli-helper

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-cli-helper

config-cli-helper

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

config-cli-helper

Helper for quickly writing commands such as npm config lsnpm config getnpm config set ...

cmd list:

  • you-cli config -h
  • you-cli config set <key>=<value> [<key>=<value> ...]
  • you-cli config get [<key> [<key> ...]]
  • you-cli config del <key> [<key> ...]
  • you-cli config ls [--json]
  • you-cli config reset

install

npm i config-cli-helper or yarn add config-cli-helper

use

import cac from 'cac';
import { getConfigStore, getConfigCli, cacHelpWithConfigCli, ParamsDescription } from 'config-cli-helper';

const cliName = 'you-cli';
const defaultConfigStore = {
  config: {
    cwd: './',
  },
};
const paramsDescription: ParamsDescription = [
  { key: 'cwd'; value: string; description: string; },
];
const configStore = getConfigStore(cliName, defaultConfigStore);

// For example, this cmd: `you-cli config ls`
if (process.argv[2] === 'config') {
  const configCli = getConfigCli({
    cliName,
    configStore, // If you want to customize 'configStore', you can pass in this parameter. Otherwise, it will generate a "configStore" for you by default
    paramsDescription,
  });
  configCli.parse(process.argv.slice(1));
  process.exit();
}

console.log('config: ', configStore.get('config')); // { cwd: './' }

// Other cmd. For example, this cmd: `you-cli -h`
const cli = cac(cliName);
cli.help(
  cacHelpWithConfigCli(cliName)
);

Keywords

cli

FAQs

Package last updated on 25 May 2023

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