Giter Club home page Giter Club logo

cli-config's Introduction

flatiron-cli-config

Encapsulated commands for managing configuration in flatiron CLI apps

Example

At its core flatiron-cli-config is a broadway-compatible plugin which can be used by any flatiron application:

  var flatiron = require('flatiron'),
      app = flatiron.app;

  //
  // Configure the Application to be a CLI app with
  // a JSON configuration file `test-config.json`
  //
  app.name = 'app.js';
  app.config.file({ file: 'test-config.json' });
  app.use(flatiron.plugins.cli, {
    usage: 'A simple CLI app using flatiron-cli-config'
  });

  //
  // Expose CLI commands using `flatiron-cli-config`
  //
  app.use(require('flatiron-cli-config'));
  
  if (!module.parent) {
    //
    // Start the application
    //
    app.start();
  }

If you run the above script:

  $ node app.js config set foo bar
  $ node app.js config get foo

The output will be:

  data: foo bar

And the contents of test-config.json will be:

  { "foo": "bar" }

API Documentation

Commands exposed

  $ node examples/app.js help config
  help:   `app.js config *` commands allow you to edit your
  help:   local app.js configuration file. Valid commands are:
  help:   
  help:   app.js config list
  help:   app.js config set    <key> <value>
  help:   app.js config get    <key>
  help:   app.js config delete <key>

Options

  {
    //
    // Name of the store in `app.config` to use for `config list`. [Default: all config]
    //
    store: 'file' 
    
    //
    // Set of properties which cannot be deleted using `config delete <key>`
    //
    restricted: ['foo', 'bar'],
    
    //
    // Set of functions which will execute before named commands: get, set, list, delete
    //
    before: { list: function () { ... } }
  }

Installation

Installing npm (node package manager)

  curl http://npmjs.org/install.sh | sh

Installing flatiron-cli-config

  [sudo] npm install flatiron-cli-config

Run Tests

Tests are written in vows and give complete coverage of all APIs and storage engines.

  $ npm test

License: MIT

cli-config's People

Contributors

avianflu avatar coderarity avatar indexzero avatar jfhbrook avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.