Skip to content

Configuration

Matthieu Lemoine edited this page Oct 7, 2018 · 1 revision

Reference

  • projectName: application name used for config persistence (required)
  • commandsDirectory: path to the directory where commands are defined (required)
  • displayName: displayed on CLI start (defaults to displayName)
  • helpers: See Helpers
  • environments: See Environments
  • defaultEnvironment: the environment to use on CLI start
  • defaultConfig: default cli config. Only used on application's first load

Example

import immersive from 'immersive';

const config = {
  // Application name used for config persistence (required)
  projectName: 'Immersive',
  // Will be displayed on CLI start (optional - default to displayName)
  displayName: 'Immersive',
  // Path to the directory where commands are defined (required)
  commandsDirectory: path.join(__dirname, 'commands'),
  // Will be accessible from commands as argument (optional)
  helpers: {
    db,
  },
  // Configuration will be passed to helpers based on the current environment (optional)
  environments: {
    development: { database: 'devdb' },
    staging: { database: 'stagingdb' },
    production: { database: 'proddb' },
  },
  // Define the current environment on CLI start
  // The current environment can be changed using the `env <envName>` command (optional)
  defaultEnvironment: 'development',
  // Default cli config (optional)
  defaultConfig: {
    // Displayed in prompt
    user: 'john',
    // Displayed in prompt
    symbol: '>',
    colors: {
      prompt: 'green',
    },
  },
};

immersive(config);

Customization

You can customize the default prompt display (colors.prompt, user, symbol) with the defaultConfig option. Immersive apps can then be customized using the config commands.

Example

config set colors.prompt blue
config set user john
config set symbol #
Clone this wiki locally