The oclif-plugin-config
is a command line utility plugin for managing configuration files with oclif. In this plugin,
commands are prefixed with a host application name placeholder, indicating that all config commands are subcommands of
the host main command.
You can install oclif-plugin-config
using npm or yarn:
$ npm install oclif-plugin-config
$ yarn add oclif-plugin-config
oclif-plugin-config
uses Jest for testing. To run tests, use the following command:
$ npm test
$ yarn test
All commands inherit from the BaseConfigCommand
, which includes the following flags:
-
--project
: Specifies the project name. -
--name
: Specifies the config file name. -
--cwd
: Specifies the config file location. -
--quiet
: Enables quiet mode.
These flags are supported by all commands in the CLI.
This command clears all configurations. Use this command when you want to reset your configurations to default state. When the command is run, a confirmation prompt is presented to the user to prevent accidental deletions.
Example:
$ <host-app> config clear
Are you sure to clear all configs? (y/n): y
Configuration has been cleared
This command deletes a specific configuration key. Provide the key as an argument to the command.
Example:
$ <host-app> config del key1
Configuration "key1" deleted
This command retrieves the value of a specific configuration key. If no key is provided, it will list all the keys and their respective values.
Example:
$ <host-app> config get key1
value1
$ <host-app> config get
➤ config from /path/to/conf
key1: value1
key2: value2
This command lists all configuration keys and their respective values.
Example:
$ <host-app> config list
➤ config from /path/to/conf
key1: value1
key2: value2
This command sets a value for a specific configuration key. Provide the key and value as arguments to the command. If a value is not provided, you'll be prompted to enter one.
Example:
$ <host-app> config set key1 value1
Configuration "key1" has been added
$ <host-app> config set key1
Enter value for key1 (blank to ignore): value1
Configuration "key1" has been updated
Contributions are welcome! Feel free to submit a pull request.
oclif-plugin-config
is released under the MIT License.