🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@4lch4/lt-commander

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4lch4/lt-commander

A helper library for building CLI applications with Commander.

latest
npmnpm
Version
0.7.4
Version published
Maintainers
2
Created
Source

Build Status

@4lch4/LT-Commander

LT-Commander is a "helper" library for building CLI applications with Commander.

Config Utilities

LT-Commander exports two configuration utilities, each of which provide a unique set of features/functionality.

ConfigUtil

This class makes use of the configstore dependency. It provides a number of methods for getting, updating, deleting, etc., of configuration settings.

Configstore Details

Easily load and persist config without having to think about where and how.

The config is stored in a JSON file located in $XDG_CONFIG_HOME or ~/.config.

Example: ~/.config/configstore/some-id.json

CosmicUtil

This class makes use of the cosmiconfig dependency which only provides a single method for loading the config file content (if it exists): load

Cosmiconfig Details

Cosmiconfig searches for and loads configuration for your program.

It features smart defaults based on conventional expectations in the JavaScript ecosystem. But it's also flexible enough to search wherever you'd like to search, and load whatever you'd like to load.

By default, Cosmiconfig will start where you tell it to start and search up the directory tree for the following:

  • A package.json property
  • A JSON or YAML, extensionless "rc file"
  • An "rc file" with the extensions .json, .yaml, .yml, .js, or .cjs
  • A .config.js or .config.cjs CommonJS module

For example, if your module's name is "myapp", cosmiconfig will search up the directory tree for configuration in the following places:

  • A myapp property in package.json
  • A .myapprc file in JSON or YAML format
  • A .myapprc.json, .myapprc.yaml, .myapprc.yml, .myapprc.js, or .myapprc.cjs file
  • A myapp.config.js or myapp.config.cjs CommonJS module exporting an object

Cosmiconfig continues to search up the directory tree, checking each of these places in each directory, until it finds some acceptable configuration (or hits the home directory). If a path is provided to the load function, then the search begins there.

FAQs

Package last updated on 07 Aug 2022

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