Configuration manager for freshbooks-cli


Configuration manager for freshbooks-cli

freshbooks-cli is a command-line interface to the FreshBooks API.

freshbooks-cli-config implements the config subcommand for freshbooks-cli.

--key, -k [String] - A configuration key to operate on. If --value is not
                     set, the current value will be written to STDOUT. Keys
                     are namespaced and delimited by ':'.

--value, -v [String] - Save a new value to the specified key.

--file, -f [Path] - Explicitely specify the configFile to operate on. If
                    not set, $HOME/.freshbooks will be used.

--edit, -e - Manually edit configuration with $EDITOR

--help, -h - Display this message
# Set the Freshbooks API base url
$ freshbooks-config -k api:url -v ""

# Set the Freshbooks API version
$ freshbooks-config -k api:version -v 2.1

# Print the current Freshbooks API version to STDOUT
$ freshbooks-config -k api:version

# Edit configuration using a text editor
$ freshbooks-config --edit

You can (and should!) use this interface to manage user configuration within your own freshbooks-cli plugins.

config = require 'freshbooks-cli-config'
# Reading the global defaults 
# Getting the current freshbooks\_config file path 
# Retrieving the nconf object 
nconf = config.getConf()
# Retrieving a value 
nconf.get 'namespace:key'

The nconf object returned using configFile() has already loaded the freshbooks\_config file, env overrides, and the global defaults (in that order of precedence).

The default freshbooks\_config file is ~/.freshbooks, which can be changed by setting the environment variable freshbooks\_config=PATH

See nconf for details.

The test suite is implemented with nodeunit and nixt.

To rebuild & run the tests

$ git clone
$ cd freshbooks-cli-config
$ npm install
$ grunt test

You can use grunt watch to automatically rebuild and run the test suite when files are changed.

Use npm link from the project directory to tell freshbooks-cli to use your modified freshbooks-cli-config during development.

To contribute back, fork the repo and open a pull request with your changes.

Copyright (c) 2013 Logan Koester Licensed under the MIT license.