A framework to build immersive CLIs & great developer tools.
- Customization
- Configuration persistence
- Auto loading of commands
- Autocomplete
- Command history
- Async commands support
- Enhanced context for commands
- Environments management
- Enhanced REPL
- Make your own REPL
- Display tabular data
- Help command
yarn add immersive
or
npm install immersive
const immersive = require('immersive');
const config = {
// Application name used for config persistence (required)
projectName: 'Immersive',
// Will be displayed on CLI start (optional - default to displayName)
displayName: 'Immersive',
// Loaded commands (required if commandsDirectory not provided) - Should be valid map of ImmersiveCommand
commands: {
'import-orgs': {
command: 'importOrgs',
description: 'Import organizations',
action: () => {},
},
},
// Path to the directory where commands are defined (required if commands not provided)
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);
Inspired by the awesome vorpal framework.