UNPKG

africa

Version:

A library to interactively create and read configuration files.

67 lines (64 loc) 2.13 kB
/** * @fileoverview * @externs */ /* typal types/index.xml externs no-embed */ /** @const */ var _africa = {} /** * The configuration object to configure additional functionality. * @record */ _africa.Config /** * Ask questions and update the configuration file even if it already exists. Default `false`. * @type {boolean|undefined} */ _africa.Config.prototype.force /** * In which directory to save and search for configuration file. Default `os.homedir()`. * @type {string|undefined} */ _africa.Config.prototype.homedir /** * How log to wait in ms before timing out. Will wait forever by default. * @type {number|undefined} */ _africa.Config.prototype.questionsTimeout /** * Whether to read a local config file in the current working directory rather than in the `HOMEDIR`. When initialising, the default values will be taken from the home config if it exists so that it is easy to extend `.rc` files. Default `false`. * @type {boolean|undefined} */ _africa.Config.prototype.local /** * **`paid`** Read all configurations up to the root one from the home directory, and merge them together. Default `false`. * @type {boolean|undefined} */ _africa.Config.prototype.recursive /** * **`paid`** When creating nested configs, skip writing values that are taken from parent RCs. Default `true`. * @type {boolean|undefined} */ _africa.Config.prototype.skipExisting /** * Function used to generate the `.rc` name. Default: packageName => `.${packageName}rc`. * @type {(function(string): string)|undefined} */ _africa.Config.prototype.rcNameFunction = function(packageName) {} /** * @param {!_reloquent.Questions} questions A set of questions. * @interface */ _africa.Group = function(questions) {} /** * The questions in the group. * @type {!_reloquent.Questions} */ _africa.Group.prototype.questions /* typal types/api.xml externs */ /** * Read package configuration from the home directory, or ask questions with readline interface to create a new configuration in `~/.${packageName}rc`. * @typedef {function(string,!_reloquent.Questions=,!_africa.Config=): !Promise<!Object>} */ _africa.africa