command-line-config

2.0.0 • Public • Published

Command Line Config

Install

npm i command-line-config

Breaking change in version 2: ESM style exports

Usage

Quick and dirty loading/saving of JSON files.

import * as settings_access from 'command-line-config'
//or...
//import { load, save } from 'command-line-config'

let settings = settings_access.load('./some_file.json')
settings.dumb = false
settings_access.save(settings, './some_file.json')

All paths are interpreted relative to the current working directory.

If you don't specify a path to load, the module assumes the file was passed in via the command-line, like so: node your-script.js config-file.json

let settings = settings_access.load()
settings.wat = "WHERE DID YOU COME FROM"
settings_access.save(settings)

Which command-line argument will be interpreted as a file to be opened? The first one to resolve to an actual file, of course!

All file-system interactions are done synchronously, which means you most likely only want to be interacting with it when your app launches/terminates (which is the most likely use case anyway).

Written for ISoft Data Systems, licensed WTFPL.

Moved to GitHub at SVN revision 27057.

/command-line-config/

    Package Sidebar

    Install

    npm i command-line-config

    Weekly Downloads

    1

    Version

    2.0.0

    License

    none

    Unpacked Size

    2.98 kB

    Total Files

    6

    Last publish

    Collaborators

    • micahsutton
    • tehshrike
    • daytonlowell