@oclif/config
- Version 1.18.17
- Published
- 55.3 kB
- 6 dependencies
- MIT license
Install
npm i @oclif/config
yarn add @oclif/config
pnpm add @oclif/config
Overview
base config object and standard interfaces for oclif components
Index
Functions
Classes
Config
- arch
- bin
- binPath
- cacheDir
- channel
- commandIDs
- commands
- configDir
- dataDir
- debug
- dir()
- dirname
- errlog
- findCommand()
- findTopic()
- home
- load()
- loadCorePlugins()
- loadDevPlugins()
- loadPlugins()
- loadUserPlugins()
- macosCacheDir()
- name
- npmRegistry
- options
- pjson
- platform
- plugins
- root
- runCommand()
- runHook()
- s3Key()
- s3Url()
- scopedEnvVar()
- scopedEnvVarKey()
- scopedEnvVarTrue()
- shell
- topics
- userAgent
- userPJSON
- valid
- version
- warn()
- warned
- windows
- windowsHome()
- windowsHomedriveHome()
- windowsUserprofileHome()
Interfaces
Type Aliases
Namespaces
Functions
function load
load: (opts?: LoadOptions) => Promise<IConfig | Config>;
Classes
class Config
class Config implements IConfig {}
constructor
constructor(options: Options);
property arch
arch: ArchTypes;
property bin
bin: string;
property binPath
binPath?: string;
property cacheDir
cacheDir: string;
property channel
channel: string;
property commandIDs
readonly commandIDs: string[];
property commands
readonly commands: Command.Plugin[];
property configDir
configDir: string;
property dataDir
dataDir: string;
property debug
debug: number;
property dirname
dirname: string;
property errlog
errlog: string;
property home
home: string;
property name
name: string;
property npmRegistry
npmRegistry?: string;
property options
options: Options;
property pjson
pjson: PJSON.CLI;
property platform
platform: PlatformTypes;
property plugins
plugins: Plugin.IPlugin[];
property root
root: string;
property shell
shell: string;
property topics
readonly topics: Topic[];
property userAgent
userAgent: string;
property userPJSON
userPJSON?: PJSON.User;
property valid
valid: boolean;
property version
version: string;
property warned
protected warned: boolean;
property windows
windows: boolean;
method dir
protected dir: (category: 'cache' | 'data' | 'config') => string;
method findCommand
findCommand: { (id: string, opts: { must: true }): Command.Plugin; (id: string, opts?: { must: boolean }): Command.Plugin;};
method findTopic
findTopic: { (id: string, opts: { must: true }): Topic; (id: string, opts?: { must: boolean }): Topic;};
method load
load: () => Promise<void>;
method loadCorePlugins
loadCorePlugins: () => Promise<void>;
method loadDevPlugins
loadDevPlugins: () => Promise<void>;
method loadPlugins
protected loadPlugins: ( root: string, type: string, plugins: (string | { root?: string; name?: string; tag?: string })[], parent?: Plugin.Plugin) => Promise<void>;
method loadUserPlugins
loadUserPlugins: () => Promise<void>;
method macosCacheDir
protected macosCacheDir: () => string | undefined;
method runCommand
runCommand: (id: string, argv?: string[]) => Promise<void>;
method runHook
runHook: <T>(event: string, opts: T) => Promise<void>;
method s3Key
s3Key: ( type: keyof PJSON.S3.Templates, ext?: '.tar.gz' | '.tar.xz' | IConfig.s3Key.Options, options?: IConfig.s3Key.Options) => string;
method s3Url
s3Url: (key: string) => string;
method scopedEnvVar
scopedEnvVar: (k: string) => string | undefined;
method scopedEnvVarKey
scopedEnvVarKey: (k: string) => string;
method scopedEnvVarTrue
scopedEnvVarTrue: (k: string) => boolean;
method warn
protected warn: ( err: string | Error | { name: string; detail: string }, scope?: string) => void;
method windowsHome
protected windowsHome: () => string | undefined;
method windowsHomedriveHome
protected windowsHomedriveHome: () => string | undefined;
method windowsUserprofileHome
protected windowsUserprofileHome: () => string | undefined;
class Plugin
class Plugin implements IPlugin {}
constructor
constructor(options: Options);
property alreadyLoaded
alreadyLoaded: boolean;
property children
children: Plugin[];
property commandIDs
readonly commandIDs: string[];
property commands
commands: Command.Plugin[];
property commandsDir
readonly commandsDir: string;
property hooks
hooks: { [k: string]: string[] };
property manifest
manifest: Manifest;
property name
name: string;
property options
options: Options;
property parent
parent: Plugin;
property pjson
pjson: PJSON.Plugin;
property root
root: string;
property tag
tag?: string;
property topics
readonly topics: Topic[];
property type
type: string;
property valid
valid: boolean;
property version
version: string;
property warned
protected warned: boolean;
method findCommand
findCommand: { (id: string, opts: { must: true }): Command.Class; (id: string, opts?: { must: boolean }): Command.Class;};
method load
load: () => Promise<void>;
method warn
protected warn: (err: any, scope?: string) => void;
Interfaces
interface Command
interface Command {}
property aliases
aliases: string[];
property args
args: Command.Arg[];
property description
description?: string;
property examples
examples?: string[];
property flags
flags: { [name: string]: Command.Flag;};
property hidden
hidden: boolean;
property id
id: string;
property pluginName
pluginName?: string;
property pluginType
pluginType?: string;
property type
type?: string;
property usage
usage?: string | string[];
interface Hooks
interface Hooks {}
property 'command_not_found'
command_not_found: { id: string;};
property 'plugins:preinstall'
'plugins:preinstall': { plugin: | { name: string; tag: string; type: 'npm'; } | { url: string; type: 'repo'; };};
property init
init: { id: string | undefined; argv: string[];};
property postrun
postrun: { Command: Config.Command.Class; result?: any; argv: string[];};
property prerun
prerun: { Command: Config.Command.Class; argv: string[];};
property preupdate
preupdate: { channel: string;};
property update
update: { channel: string;};
index signature
[event: string]: object;
interface IConfig
interface IConfig {}
property arch
arch: ArchTypes;
process.arch
property bin
bin: string;
bin name of CLI command
property binPath
binPath?: string;
property cacheDir
cacheDir: string;
cache directory to use for CLI
example ~/Library/Caches/mycli or ~/.cache/mycli
property channel
channel: string;
property commandIDs
readonly commandIDs: string[];
property commands
readonly commands: Command.Plugin[];
property configDir
configDir: string;
config directory to use for CLI
example: ~/.config/mycli
property dataDir
dataDir: string;
data directory to use for CLI
example: ~/.local/share/mycli
property debug
debug: number;
debugging level
set by ${BIN}_DEBUG or DEBUG=$BIN
property dirname
dirname: string;
base dirname to use in cacheDir/configDir/dataDir
property errlog
errlog: string;
points to a file that should be appended to for error logs
example: ~/Library/Caches/mycli/error.log
property home
home: string;
path to home directory
example: /home/myuser
property name
name: string;
property npmRegistry
npmRegistry?: string;
npm registry to use for installing plugins
property pjson
pjson: PJSON.CLI;
property platform
platform: PlatformTypes;
process.platform
property plugins
plugins: Plugin.IPlugin[];
property root
root: string;
property shell
shell: string;
active shell
property topics
readonly topics: Topic[];
property userAgent
userAgent: string;
user agent to use for http calls
example: mycli/1.2.3 (darwin-x64) node-9.0.0
property userPJSON
userPJSON?: PJSON.User;
property valid
valid: boolean;
property version
version: string;
property windows
windows: boolean;
if windows
method findCommand
findCommand: { (id: string, opts: { must: true }): Command.Plugin; (id: string, opts?: { must: boolean }): Command.Plugin;};
method findTopic
findTopic: { (id: string, opts: { must: true }): Topic; (id: string, opts?: { must: boolean }): Topic;};
method runCommand
runCommand: (id: string, argv?: string[]) => Promise<void>;
method runHook
runHook: <T extends Hooks, K extends Extract<keyof T, string>>( event: K, opts: T[K]) => Promise<void>;
method s3Key
s3Key: { ( type: 'versioned' | 'unversioned', ext: '.tar.gz' | '.tar.xz', options?: IConfig.s3Key.Options ): string; (type: keyof PJSON.S3.Templates, options?: IConfig.s3Key.Options): string;};
method s3Url
s3Url: (key: string) => string;
method scopedEnvVar
scopedEnvVar: (key: string) => string | undefined;
method scopedEnvVarKey
scopedEnvVarKey: (key: string) => string;
method scopedEnvVarTrue
scopedEnvVarTrue: (key: string) => boolean;
interface IPlugin
interface IPlugin {}
property commandIDs
readonly commandIDs: string[];
property commands
commands: Command.Plugin[];
property hooks
hooks: { [k: string]: string[];};
property name
name: string;
name from package.json
property pjson
pjson: PJSON.Plugin | PJSON.CLI;
full package.json
parsed with read-pkg
property root
root: string;
base path of plugin
property tag
tag?: string;
npm dist-tag of plugin only used for user plugins
property topics
readonly topics: Topic[];
property type
type: string;
used to tell the user how the plugin was installed examples: core, link, user, dev
property valid
valid: boolean;
if it appears to be an npm package but does not look like it's really a CLI plugin, this is set to false
property version
version: string;
version from package.json
example: 1.2.3
method findCommand
findCommand: { (id: string, opts: { must: true }): Command.Class; (id: string, opts?: { must: boolean }): Command.Class;};
method load
load: () => Promise<void>;
interface Manifest
interface Manifest {}
interface Options
interface Options extends Plugin.Options {}
property channel
channel?: string;
property devPlugins
devPlugins?: boolean;
property userPlugins
userPlugins?: boolean;
property version
version?: string;
interface PJSON
interface PJSON {}
property dependencies
dependencies?: { [name: string]: string;};
property oclif
oclif: { schema?: number;};
index signature
[k: string]: any;
interface Topic
interface Topic {}
Type Aliases
type ArchTypes
type ArchTypes = | 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86';
type Hook
type Hook<T> = ( this: Hook.Context, options: HookKeyOrOptions<T> & { config: Config.IConfig; }) => any;
type LoadOptions
type LoadOptions = Options | string | IConfig | undefined;
type PlatformTypes
type PlatformTypes = | 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos' | 'wsl';
Namespaces
namespace Command
namespace Command {}
function toCached
toCached: (c: Class, plugin?: Config.Plugin) => Command;
interface Arg
interface Arg {}
interface Base
interface Base {}
interface Class
interface Class extends Base {}
property args
args?: Parser.args.Input;
property flags
flags?: Parser.flags.Input<any>;
property plugin
plugin?: Config.IPlugin;
method run
run: (argv?: string[], config?: Config.LoadOptions) => PromiseLike<any>;
construct signature
new (argv: string[], config: Config.IConfig): Instance;
interface Instance
interface Instance {}
type Flag
type Flag = Flag.Boolean | Flag.Option;
namespace Command.Flag
namespace Command.Flag {}
interface Boolean
interface Boolean {}
interface Option
interface Option {}
property char
char?: string;
property default
default?: string;
property description
description?: string;
property helpLabel
helpLabel?: string;
property helpValue
helpValue?: string;
property hidden
hidden?: boolean;
property name
name: string;
property options
options?: string[];
property required
required?: boolean;
property type
type: 'option';
namespace Hook
namespace Hook {}
interface Context
interface Context {}
property config
config: Config.IConfig;
method debug
debug: (...args: any[]) => void;
method error
error: ( message: string | Error, options?: { code?: string; exit?: number }) => void;
method exit
exit: (code?: number) => void;
method log
log: (message?: any, ...args: any[]) => void;
method warn
warn: (message: string) => void;
type CommandNotFound
type CommandNotFound = Hook<Hooks['command_not_found']>;
type Init
type Init = Hook<Hooks['init']>;
type PluginsPreinstall
type PluginsPreinstall = Hook<Hooks['plugins:preinstall']>;
type Postrun
type Postrun = Hook<Hooks['postrun']>;
type Prerun
type Prerun = Hook<Hooks['prerun']>;
type Preupdate
type Preupdate = Hook<Hooks['preupdate']>;
type Update
type Update = Hook<Hooks['update']>;
namespace IConfig
namespace IConfig {}
namespace IConfig.s3Key
namespace IConfig.s3Key {}
interface Options
interface Options {}
property arch
arch?: ArchTypes;
property platform
platform?: PlatformTypes;
index signature
[key: string]: any;
namespace PJSON
namespace PJSON {}
interface CLI
interface CLI extends Plugin {}
property oclif
oclif: Plugin['oclif'] & { schema?: number; bin?: string; npmRegistry?: string; scope?: string; dirname?: string;};
interface Plugin
interface Plugin extends PJSON {}
property name
name: string;
property oclif
oclif: PJSON['oclif'] & { schema?: number; title?: string; description?: string; hooks?: { [name: string]: string | string[]; }; commands?: string; plugins?: string[]; devPlugins?: string[]; helpClass?: string; aliases?: { [name: string]: string | null; }; repositoryPrefix?: string; update: { s3: S3; autoupdate?: { rollout?: number; debounce?: number; }; node: { version?: string; targets?: string[]; }; }; topics?: { [k: string]: { description?: string; subtopics?: Plugin['oclif']['topics']; hidden?: boolean; }; };};
property version
version: string;
interface S3
interface S3 {}
interface User
interface User extends PJSON {}
type PluginTypes
type PluginTypes = | PluginTypes.User | PluginTypes.Link | { root: string; };
namespace PJSON.PluginTypes
namespace PJSON.PluginTypes {}
Package Files (8)
Dependencies (6)
Dev Dependencies (18)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@oclif/config
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@oclif/config)
- HTML<a href="https://www.jsdocs.io/package/@oclif/config"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4443 ms. - Missing or incorrect documentation? Open an issue for this package.