@oclif/core 3.0.0-beta.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/flush.d.ts +3 -0
- package/flush.js +1 -0
- package/handle.js +1 -0
- package/lib/args.d.ts +2 -2
- package/lib/args.js +17 -18
- package/lib/{ux → cli-ux}/action/base.d.ts +19 -21
- package/lib/{ux → cli-ux}/action/base.js +126 -120
- package/lib/{ux → cli-ux}/action/simple.js +25 -30
- package/lib/{ux → cli-ux}/action/spinner.d.ts +9 -7
- package/lib/{ux → cli-ux}/action/spinner.js +45 -37
- package/lib/{ux → cli-ux}/action/spinners.js +187 -187
- package/lib/cli-ux/action/types.d.ts +5 -0
- package/lib/cli-ux/action/types.js +2 -0
- package/lib/{ux → cli-ux}/config.d.ts +5 -5
- package/lib/{ux → cli-ux}/config.js +17 -17
- package/lib/{ux → cli-ux}/exit.js +3 -0
- package/lib/cli-ux/flush.d.ts +1 -0
- package/lib/cli-ux/flush.js +28 -0
- package/lib/cli-ux/index.d.ts +39 -0
- package/lib/{ux → cli-ux}/index.js +74 -88
- package/lib/{ux → cli-ux}/list.js +3 -3
- package/lib/{ux → cli-ux}/prompt.d.ts +3 -3
- package/lib/{ux → cli-ux}/prompt.js +35 -25
- package/lib/{ux → cli-ux}/stream.d.ts +6 -6
- package/lib/{ux → cli-ux}/stream.js +11 -10
- package/lib/cli-ux/styled/index.d.ts +4 -0
- package/lib/cli-ux/styled/index.js +11 -0
- package/lib/{ux → cli-ux}/styled/object.js +7 -9
- package/lib/{ux → cli-ux}/styled/table.d.ts +10 -10
- package/lib/{ux → cli-ux}/styled/table.js +130 -133
- package/lib/{ux → cli-ux}/styled/tree.js +11 -13
- package/lib/cli-ux/wait.js +5 -0
- package/lib/command.d.ts +82 -88
- package/lib/command.js +196 -175
- package/lib/config/config.d.ts +89 -90
- package/lib/config/config.js +466 -566
- package/lib/config/index.d.ts +0 -1
- package/lib/config/index.js +1 -3
- package/lib/config/plugin-loader.d.ts +12 -12
- package/lib/config/plugin-loader.js +72 -56
- package/lib/config/plugin.d.ts +25 -24
- package/lib/config/plugin.js +188 -154
- package/lib/config/ts-node.d.ts +2 -1
- package/lib/config/ts-node.js +71 -58
- package/lib/config/util.d.ts +1 -11
- package/lib/config/util.js +6 -59
- package/lib/errors/config.d.ts +1 -1
- package/lib/errors/config.js +6 -6
- package/lib/errors/errors/cli.d.ts +7 -7
- package/lib/errors/errors/cli.js +20 -16
- package/lib/errors/errors/exit.d.ts +1 -4
- package/lib/errors/errors/exit.js +1 -1
- package/lib/errors/errors/module-load.d.ts +1 -4
- package/lib/errors/errors/module-load.js +1 -1
- package/lib/errors/errors/pretty-print.d.ts +1 -1
- package/lib/errors/errors/pretty-print.js +12 -10
- package/lib/errors/handle.d.ts +12 -2
- package/lib/errors/handle.js +26 -14
- package/lib/errors/index.d.ts +10 -10
- package/lib/errors/index.js +25 -24
- package/lib/errors/logger.d.ts +2 -2
- package/lib/errors/logger.js +14 -13
- package/lib/execute.d.ts +6 -6
- package/lib/execute.js +10 -9
- package/lib/flags.d.ts +103 -32
- package/lib/flags.js +79 -45
- package/lib/help/command.d.ts +16 -14
- package/lib/help/command.js +178 -163
- package/lib/help/docopts.d.ts +5 -5
- package/lib/help/docopts.js +50 -54
- package/lib/help/formatter.d.ts +37 -37
- package/lib/help/formatter.js +66 -55
- package/lib/help/index.d.ts +25 -21
- package/lib/help/index.js +169 -147
- package/lib/help/root.d.ts +1 -1
- package/lib/help/root.js +15 -17
- package/lib/help/util.d.ts +2 -8
- package/lib/help/util.js +8 -28
- package/lib/index.d.ts +19 -20
- package/lib/index.js +37 -43
- package/lib/interfaces/config.d.ts +67 -66
- package/lib/interfaces/errors.d.ts +5 -5
- package/lib/interfaces/help.d.ts +17 -17
- package/lib/interfaces/hooks.d.ts +49 -49
- package/lib/interfaces/index.d.ts +7 -7
- package/lib/interfaces/manifest.d.ts +1 -1
- package/lib/interfaces/parser.d.ts +175 -51
- package/lib/interfaces/pjson.d.ts +41 -41
- package/lib/interfaces/plugin.d.ts +47 -41
- package/lib/interfaces/s3-manifest.d.ts +7 -7
- package/lib/interfaces/topic.d.ts +1 -1
- package/lib/interfaces/ts-config.d.ts +7 -7
- package/lib/main.d.ts +2 -2
- package/lib/main.js +16 -16
- package/lib/module-loader.d.ts +67 -77
- package/lib/module-loader.js +183 -150
- package/lib/parser/errors.d.ts +7 -7
- package/lib/parser/errors.js +29 -22
- package/lib/parser/help.js +5 -5
- package/lib/parser/index.js +2 -2
- package/lib/parser/parse.d.ts +9 -6
- package/lib/parser/parse.js +253 -221
- package/lib/parser/validate.js +53 -33
- package/lib/performance.d.ts +43 -32
- package/lib/performance.js +133 -91
- package/lib/screen.js +2 -2
- package/lib/settings.d.ts +11 -12
- package/lib/settings.js +2 -2
- package/lib/util/aggregate-flags.d.ts +2 -0
- package/lib/util/aggregate-flags.js +13 -0
- package/lib/util/cache-command.d.ts +3 -0
- package/lib/util/cache-command.js +109 -0
- package/lib/util/cache-default-value.d.ts +2 -0
- package/lib/util/cache-default-value.js +28 -0
- package/lib/util/ensure-arg-object.d.ts +12 -0
- package/lib/util/ensure-arg-object.js +14 -0
- package/lib/util/fs.d.ts +7 -0
- package/lib/util/fs.js +54 -0
- package/lib/util/os.d.ts +19 -0
- package/lib/util/os.js +28 -0
- package/lib/{util.d.ts → util/util.d.ts} +7 -16
- package/lib/util/util.js +98 -0
- package/package.json +35 -37
- package/lib/util.js +0 -126
- package/lib/ux/flush.d.ts +0 -1
- package/lib/ux/flush.js +0 -27
- package/lib/ux/index.d.ts +0 -58
- package/lib/ux/styled/index.d.ts +0 -6
- package/lib/ux/styled/index.js +0 -13
- package/lib/ux/styled/json.d.ts +0 -1
- package/lib/ux/styled/json.js +0 -15
- package/lib/ux/wait.js +0 -7
- package/lib/{ux → cli-ux}/action/simple.d.ts +4 -4
- package/lib/{ux → cli-ux}/action/spinners.d.ts +117 -117
- package/lib/{ux → cli-ux}/exit.d.ts +2 -2
- package/lib/{ux → cli-ux}/list.d.ts +0 -0
- package/lib/{ux → cli-ux}/styled/object.d.ts +0 -0
- package/lib/{ux → cli-ux}/styled/progress.d.ts +0 -0
- package/lib/{ux → cli-ux}/styled/progress.js +0 -0
- package/lib/{ux → cli-ux}/styled/tree.d.ts +1 -1
- /package/lib/{ux → cli-ux}/wait.d.ts +0 -0
package/lib/index.js
CHANGED
|
@@ -1,48 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const main_1 = require("./main");
|
|
7
|
-
exports.run = main_1.default;
|
|
8
|
-
const execute_1 = require("./execute");
|
|
9
|
-
exports.execute = execute_1.default;
|
|
10
|
-
const handle_1 = require("./errors/handle");
|
|
11
|
-
exports.handle = handle_1.default;
|
|
12
|
-
const config_1 = require("./config");
|
|
13
|
-
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
14
|
-
Object.defineProperty(exports, "Plugin", { enumerable: true, get: function () { return config_1.Plugin; } });
|
|
15
|
-
Object.defineProperty(exports, "tsPath", { enumerable: true, get: function () { return config_1.tsPath; } });
|
|
16
|
-
Object.defineProperty(exports, "toCached", { enumerable: true, get: function () { return config_1.toCached; } });
|
|
17
|
-
const Interfaces = require("./interfaces");
|
|
18
|
-
exports.Interfaces = Interfaces;
|
|
19
|
-
const Errors = require("./errors");
|
|
20
|
-
exports.Errors = Errors;
|
|
21
|
-
const Flags = require("./flags");
|
|
22
|
-
exports.Flags = Flags;
|
|
23
|
-
const Args = require("./args");
|
|
24
|
-
exports.Args = Args;
|
|
25
|
-
const help_1 = require("./help");
|
|
26
|
-
Object.defineProperty(exports, "CommandHelp", { enumerable: true, get: function () { return help_1.CommandHelp; } });
|
|
27
|
-
Object.defineProperty(exports, "HelpBase", { enumerable: true, get: function () { return help_1.HelpBase; } });
|
|
28
|
-
Object.defineProperty(exports, "Help", { enumerable: true, get: function () { return help_1.Help; } });
|
|
29
|
-
Object.defineProperty(exports, "loadHelpClass", { enumerable: true, get: function () { return help_1.loadHelpClass; } });
|
|
30
|
-
const util_1 = require("./help/util");
|
|
31
|
-
Object.defineProperty(exports, "toStandardizedId", { enumerable: true, get: function () { return util_1.toStandardizedId; } });
|
|
32
|
-
Object.defineProperty(exports, "toConfiguredId", { enumerable: true, get: function () { return util_1.toConfiguredId; } });
|
|
33
|
-
const Parser = require("./parser");
|
|
34
|
-
exports.Parser = Parser;
|
|
35
|
-
const settings_1 = require("./settings");
|
|
36
|
-
exports.settings = settings_1.default;
|
|
37
|
-
const ux = require("./ux");
|
|
38
|
-
exports.ux = ux;
|
|
39
|
-
const stream_1 = require("./ux/stream");
|
|
40
|
-
Object.defineProperty(exports, "stderr", { enumerable: true, get: function () { return stream_1.stderr; } });
|
|
41
|
-
Object.defineProperty(exports, "stdout", { enumerable: true, get: function () { return stream_1.stdout; } });
|
|
42
|
-
const performance_1 = require("./performance");
|
|
43
|
-
exports.Performance = performance_1.default;
|
|
44
|
-
const flush_1 = require("./ux/flush");
|
|
45
|
-
exports.flush = flush_1.default;
|
|
3
|
+
exports.settings = exports.Performance = exports.Parser = exports.run = exports.Interfaces = exports.toStandardizedId = exports.toConfiguredId = exports.loadHelpClass = exports.HelpBase = exports.Help = exports.CommandHelp = exports.Flags = exports.execute = exports.handle = exports.Errors = exports.Plugin = exports.Config = exports.Command = exports.stdout = exports.stderr = exports.flush = exports.ux = exports.Args = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const stream_1 = require("./cli-ux/stream");
|
|
46
6
|
function checkCWD() {
|
|
47
7
|
try {
|
|
48
8
|
process.cwd();
|
|
@@ -54,3 +14,37 @@ function checkCWD() {
|
|
|
54
14
|
}
|
|
55
15
|
}
|
|
56
16
|
checkCWD();
|
|
17
|
+
exports.Args = tslib_1.__importStar(require("./args"));
|
|
18
|
+
exports.ux = tslib_1.__importStar(require("./cli-ux"));
|
|
19
|
+
var flush_1 = require("./cli-ux/flush");
|
|
20
|
+
Object.defineProperty(exports, "flush", { enumerable: true, get: function () { return flush_1.flush; } });
|
|
21
|
+
var stream_2 = require("./cli-ux/stream");
|
|
22
|
+
Object.defineProperty(exports, "stderr", { enumerable: true, get: function () { return stream_2.stderr; } });
|
|
23
|
+
Object.defineProperty(exports, "stdout", { enumerable: true, get: function () { return stream_2.stdout; } });
|
|
24
|
+
var command_1 = require("./command");
|
|
25
|
+
Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return command_1.Command; } });
|
|
26
|
+
var config_1 = require("./config");
|
|
27
|
+
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
28
|
+
Object.defineProperty(exports, "Plugin", { enumerable: true, get: function () { return config_1.Plugin; } });
|
|
29
|
+
exports.Errors = tslib_1.__importStar(require("./errors"));
|
|
30
|
+
var handle_1 = require("./errors/handle");
|
|
31
|
+
Object.defineProperty(exports, "handle", { enumerable: true, get: function () { return handle_1.handle; } });
|
|
32
|
+
var execute_1 = require("./execute");
|
|
33
|
+
Object.defineProperty(exports, "execute", { enumerable: true, get: function () { return execute_1.execute; } });
|
|
34
|
+
exports.Flags = tslib_1.__importStar(require("./flags"));
|
|
35
|
+
var help_1 = require("./help");
|
|
36
|
+
Object.defineProperty(exports, "CommandHelp", { enumerable: true, get: function () { return help_1.CommandHelp; } });
|
|
37
|
+
Object.defineProperty(exports, "Help", { enumerable: true, get: function () { return help_1.Help; } });
|
|
38
|
+
Object.defineProperty(exports, "HelpBase", { enumerable: true, get: function () { return help_1.HelpBase; } });
|
|
39
|
+
Object.defineProperty(exports, "loadHelpClass", { enumerable: true, get: function () { return help_1.loadHelpClass; } });
|
|
40
|
+
var util_1 = require("./help/util");
|
|
41
|
+
Object.defineProperty(exports, "toConfiguredId", { enumerable: true, get: function () { return util_1.toConfiguredId; } });
|
|
42
|
+
Object.defineProperty(exports, "toStandardizedId", { enumerable: true, get: function () { return util_1.toStandardizedId; } });
|
|
43
|
+
exports.Interfaces = tslib_1.__importStar(require("./interfaces"));
|
|
44
|
+
var main_1 = require("./main");
|
|
45
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return main_1.run; } });
|
|
46
|
+
exports.Parser = tslib_1.__importStar(require("./parser"));
|
|
47
|
+
var performance_1 = require("./performance");
|
|
48
|
+
Object.defineProperty(exports, "Performance", { enumerable: true, get: function () { return performance_1.Performance; } });
|
|
49
|
+
var settings_1 = require("./settings");
|
|
50
|
+
Object.defineProperty(exports, "settings", { enumerable: true, get: function () { return settings_1.settings; } });
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Command } from '../command';
|
|
3
|
+
import { Hook, Hooks } from './hooks';
|
|
1
4
|
import { PJSON } from './pjson';
|
|
2
|
-
import {
|
|
3
|
-
import { Plugin, Options } from './plugin';
|
|
5
|
+
import { Options, Plugin } from './plugin';
|
|
4
6
|
import { Topic } from './topic';
|
|
5
|
-
|
|
6
|
-
export type
|
|
7
|
-
export type PlatformTypes = 'darwin' | 'linux' | 'win32' | 'aix' | 'freebsd' | 'openbsd' | 'sunos' | 'wsl';
|
|
7
|
+
export type LoadOptions = Config | Options | string | undefined;
|
|
8
|
+
export type PlatformTypes = 'wsl' | NodeJS.Platform;
|
|
8
9
|
export type ArchTypes = 'arm' | 'arm64' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'x86';
|
|
9
10
|
export type PluginVersionDetail = {
|
|
10
|
-
version: string;
|
|
11
|
-
type: string;
|
|
12
11
|
root: string;
|
|
12
|
+
type: string;
|
|
13
|
+
version: string;
|
|
13
14
|
};
|
|
14
15
|
export type VersionDetails = {
|
|
15
|
-
cliVersion: string;
|
|
16
16
|
architecture: string;
|
|
17
|
+
cliVersion: string;
|
|
17
18
|
nodeVersion: string;
|
|
18
|
-
pluginVersions?: Record<string, PluginVersionDetail>;
|
|
19
19
|
osVersion?: string;
|
|
20
|
-
|
|
20
|
+
pluginVersions?: Record<string, PluginVersionDetail>;
|
|
21
21
|
rootPath?: string;
|
|
22
|
+
shell?: string;
|
|
22
23
|
};
|
|
23
24
|
export interface Config {
|
|
24
|
-
readonly name: string;
|
|
25
|
-
readonly version: string;
|
|
26
|
-
readonly channel: string;
|
|
27
|
-
readonly pjson: PJSON.CLI;
|
|
28
|
-
readonly root: string;
|
|
29
25
|
/**
|
|
30
26
|
* process.arch
|
|
31
27
|
*/
|
|
@@ -34,12 +30,20 @@ export interface Config {
|
|
|
34
30
|
* bin name of CLI command
|
|
35
31
|
*/
|
|
36
32
|
readonly bin: string;
|
|
33
|
+
/**
|
|
34
|
+
* name of any bin aliases that will execute the cli
|
|
35
|
+
*/
|
|
36
|
+
readonly binAliases?: string[];
|
|
37
|
+
readonly binPath?: string;
|
|
37
38
|
/**
|
|
38
39
|
* cache directory to use for CLI
|
|
39
40
|
*
|
|
40
41
|
* example ~/Library/Caches/mycli or ~/.cache/mycli
|
|
41
42
|
*/
|
|
42
43
|
readonly cacheDir: string;
|
|
44
|
+
readonly channel: string;
|
|
45
|
+
readonly commandIDs: string[];
|
|
46
|
+
readonly commands: Command.Loadable[];
|
|
43
47
|
/**
|
|
44
48
|
* config directory to use for CLI
|
|
45
49
|
*
|
|
@@ -52,6 +56,12 @@ export interface Config {
|
|
|
52
56
|
* example: ~/.local/share/mycli
|
|
53
57
|
*/
|
|
54
58
|
readonly dataDir: string;
|
|
59
|
+
/**
|
|
60
|
+
* debugging level
|
|
61
|
+
*
|
|
62
|
+
* set by ${BIN}_DEBUG or DEBUG=$BIN
|
|
63
|
+
*/
|
|
64
|
+
readonly debug: number;
|
|
55
65
|
/**
|
|
56
66
|
* base dirname to use in cacheDir/configDir/dataDir
|
|
57
67
|
*/
|
|
@@ -62,86 +72,77 @@ export interface Config {
|
|
|
62
72
|
* example: ~/Library/Caches/mycli/error.log
|
|
63
73
|
*/
|
|
64
74
|
readonly errlog: string;
|
|
75
|
+
findCommand(id: string, opts: {
|
|
76
|
+
must: true;
|
|
77
|
+
}): Command.Loadable;
|
|
78
|
+
findCommand(id: string, opts?: {
|
|
79
|
+
must: boolean;
|
|
80
|
+
}): Command.Loadable | undefined;
|
|
81
|
+
findMatches(id: string, argv: string[]): Command.Loadable[];
|
|
82
|
+
findTopic(id: string, opts: {
|
|
83
|
+
must: true;
|
|
84
|
+
}): Topic;
|
|
85
|
+
findTopic(id: string, opts?: {
|
|
86
|
+
must: boolean;
|
|
87
|
+
}): Topic | undefined;
|
|
88
|
+
readonly flexibleTaxonomy?: boolean;
|
|
89
|
+
getAllCommandIDs(): string[];
|
|
90
|
+
getAllCommands(): Command.Loadable[];
|
|
91
|
+
getPluginsList(): Plugin[];
|
|
65
92
|
/**
|
|
66
93
|
* path to home directory
|
|
67
94
|
*
|
|
68
95
|
* example: /home/myuser
|
|
69
96
|
*/
|
|
70
97
|
readonly home: string;
|
|
98
|
+
readonly name: string;
|
|
99
|
+
/**
|
|
100
|
+
* npm registry to use for installing plugins
|
|
101
|
+
*/
|
|
102
|
+
readonly npmRegistry?: string;
|
|
103
|
+
readonly nsisCustomization?: string;
|
|
104
|
+
readonly pjson: PJSON.CLI;
|
|
71
105
|
/**
|
|
72
106
|
* process.platform
|
|
73
107
|
*/
|
|
74
108
|
readonly platform: PlatformTypes;
|
|
109
|
+
readonly plugins: Map<string, Plugin>;
|
|
110
|
+
readonly root: string;
|
|
111
|
+
runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable): Promise<T>;
|
|
112
|
+
runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>;
|
|
113
|
+
s3Key(type: 'unversioned' | 'versioned', ext: '.tar.gz' | '.tar.xz', options?: Config.s3Key.Options): string;
|
|
114
|
+
s3Key(type: keyof PJSON.S3.Templates, options?: Config.s3Key.Options): string;
|
|
115
|
+
s3Url(key: string): string;
|
|
116
|
+
scopedEnvVar(key: string): string | undefined;
|
|
117
|
+
scopedEnvVarKey(key: string): string;
|
|
118
|
+
scopedEnvVarKeys(key: string): string[];
|
|
119
|
+
scopedEnvVarTrue(key: string): boolean;
|
|
75
120
|
/**
|
|
76
121
|
* active shell
|
|
77
122
|
*/
|
|
78
123
|
readonly shell: string;
|
|
124
|
+
topicSeparator: ' ' | ':';
|
|
125
|
+
readonly topics: Topic[];
|
|
79
126
|
/**
|
|
80
127
|
* user agent to use for http calls
|
|
81
128
|
*
|
|
82
129
|
* example: mycli/1.2.3 (darwin-x64) node-9.0.0
|
|
83
130
|
*/
|
|
84
131
|
readonly userAgent: string;
|
|
132
|
+
readonly valid: boolean;
|
|
133
|
+
readonly version: string;
|
|
134
|
+
readonly versionDetails: VersionDetails;
|
|
85
135
|
/**
|
|
86
136
|
* if windows
|
|
87
137
|
*/
|
|
88
138
|
readonly windows: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* debugging level
|
|
91
|
-
*
|
|
92
|
-
* set by ${BIN}_DEBUG or DEBUG=$BIN
|
|
93
|
-
*/
|
|
94
|
-
readonly debug: number;
|
|
95
|
-
/**
|
|
96
|
-
* npm registry to use for installing plugins
|
|
97
|
-
*/
|
|
98
|
-
readonly npmRegistry?: string;
|
|
99
|
-
readonly plugins: Map<string, Plugin>;
|
|
100
|
-
readonly binPath?: string;
|
|
101
|
-
/**
|
|
102
|
-
* name of any bin aliases that will execute the cli
|
|
103
|
-
*/
|
|
104
|
-
readonly binAliases?: string[];
|
|
105
|
-
readonly nsisCustomization?: string;
|
|
106
|
-
readonly valid: boolean;
|
|
107
|
-
readonly flexibleTaxonomy?: boolean;
|
|
108
|
-
topicSeparator: ':' | ' ';
|
|
109
|
-
readonly commands: Command.Loadable[];
|
|
110
|
-
readonly topics: Topic[];
|
|
111
|
-
readonly commandIDs: string[];
|
|
112
|
-
readonly versionDetails: VersionDetails;
|
|
113
|
-
runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable): Promise<T>;
|
|
114
|
-
runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>;
|
|
115
|
-
getAllCommandIDs(): string[];
|
|
116
|
-
getAllCommands(): Command.Loadable[];
|
|
117
|
-
findCommand(id: string, opts: {
|
|
118
|
-
must: true;
|
|
119
|
-
}): Command.Loadable;
|
|
120
|
-
findCommand(id: string, opts?: {
|
|
121
|
-
must: boolean;
|
|
122
|
-
}): Command.Loadable | undefined;
|
|
123
|
-
findTopic(id: string, opts: {
|
|
124
|
-
must: true;
|
|
125
|
-
}): Topic;
|
|
126
|
-
findTopic(id: string, opts?: {
|
|
127
|
-
must: boolean;
|
|
128
|
-
}): Topic | undefined;
|
|
129
|
-
findMatches(id: string, argv: string[]): Command.Loadable[];
|
|
130
|
-
scopedEnvVar(key: string): string | undefined;
|
|
131
|
-
scopedEnvVarKey(key: string): string;
|
|
132
|
-
scopedEnvVarKeys(key: string): string[];
|
|
133
|
-
scopedEnvVarTrue(key: string): boolean;
|
|
134
|
-
s3Url(key: string): string;
|
|
135
|
-
s3Key(type: 'versioned' | 'unversioned', ext: '.tar.gz' | '.tar.xz', options?: Config.s3Key.Options): string;
|
|
136
|
-
s3Key(type: keyof PJSON.S3.Templates, options?: Config.s3Key.Options): string;
|
|
137
|
-
getPluginsList(): Plugin[];
|
|
138
139
|
}
|
|
139
140
|
export declare namespace Config {
|
|
140
141
|
namespace s3Key {
|
|
141
142
|
interface Options {
|
|
142
|
-
platform?: PlatformTypes;
|
|
143
|
-
arch?: ArchTypes;
|
|
144
143
|
[key: string]: any;
|
|
144
|
+
arch?: ArchTypes;
|
|
145
|
+
platform?: PlatformTypes;
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
}
|
|
@@ -3,18 +3,18 @@ export type CommandError = Error & {
|
|
|
3
3
|
};
|
|
4
4
|
export interface OclifError {
|
|
5
5
|
oclif: {
|
|
6
|
-
exit?: number
|
|
6
|
+
exit?: number;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export interface PrettyPrintableError {
|
|
10
|
-
/**
|
|
11
|
-
* message to display related to the error
|
|
12
|
-
*/
|
|
13
|
-
message?: string;
|
|
14
10
|
/**
|
|
15
11
|
* a unique error code for this error class
|
|
16
12
|
*/
|
|
17
13
|
code?: string;
|
|
14
|
+
/**
|
|
15
|
+
* message to display related to the error
|
|
16
|
+
*/
|
|
17
|
+
message?: string;
|
|
18
18
|
/**
|
|
19
19
|
* a url to find out more information related to this error
|
|
20
20
|
* or fixing the error
|
package/lib/interfaces/help.d.ts
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
export interface HelpOptions {
|
|
2
2
|
all?: boolean;
|
|
3
|
-
maxWidth: number;
|
|
4
|
-
stripAnsi?: boolean;
|
|
5
|
-
/**
|
|
6
|
-
* By default, option values on flags are shown in the flag's description. This is because
|
|
7
|
-
* long options list ruin the formatting of help. If a CLI knows all commands will not
|
|
8
|
-
* do this, it can be turned off at a help level using this property. An individual flag
|
|
9
|
-
* can set this using `flag.helpValue=options.join('|')`.
|
|
10
|
-
*/
|
|
11
|
-
showFlagOptionsInTitle?: boolean;
|
|
12
3
|
/**
|
|
13
|
-
*
|
|
14
|
-
* to show the flag name as the value. i.e. `--myflag=myflag` instead of `--myflag=<value>`.
|
|
15
|
-
* An individual flag can set this using `flag.helpValue=flag.name`.
|
|
4
|
+
* Use docopts as the usage. Defaults to true.
|
|
16
5
|
*/
|
|
17
|
-
|
|
6
|
+
docopts?: boolean;
|
|
18
7
|
/**
|
|
19
8
|
* By default, the command summary is show at the top of the help and as the first line in
|
|
20
9
|
* the command description. Repeating the summary in the command description improves readability
|
|
@@ -23,13 +12,24 @@ export interface HelpOptions {
|
|
|
23
12
|
* not want the duplication.
|
|
24
13
|
*/
|
|
25
14
|
hideCommandSummaryInDescription?: boolean;
|
|
15
|
+
maxWidth: number;
|
|
16
|
+
/**
|
|
17
|
+
* By default, titles show flag values as `<value>`. Some CLI developers may prefer titles
|
|
18
|
+
* to show the flag name as the value. i.e. `--myflag=myflag` instead of `--myflag=<value>`.
|
|
19
|
+
* An individual flag can set this using `flag.helpValue=flag.name`.
|
|
20
|
+
*/
|
|
21
|
+
showFlagNameInTitle?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* By default, option values on flags are shown in the flag's description. This is because
|
|
24
|
+
* long options list ruin the formatting of help. If a CLI knows all commands will not
|
|
25
|
+
* do this, it can be turned off at a help level using this property. An individual flag
|
|
26
|
+
* can set this using `flag.helpValue=options.join('|')`.
|
|
27
|
+
*/
|
|
28
|
+
showFlagOptionsInTitle?: boolean;
|
|
29
|
+
stripAnsi?: boolean;
|
|
26
30
|
/**
|
|
27
31
|
* Use USAGE, but some may want to use USAGE as used in gnu man pages. See help recommendations at
|
|
28
32
|
* http://www.gnu.org/software/help2man/#--help-recommendations
|
|
29
33
|
*/
|
|
30
34
|
usageHeader?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Use docopts as the usage. Defaults to true.
|
|
33
|
-
*/
|
|
34
|
-
docopts?: boolean;
|
|
35
35
|
}
|
|
@@ -7,62 +7,33 @@ interface HookMeta {
|
|
|
7
7
|
}
|
|
8
8
|
export interface Hooks {
|
|
9
9
|
[event: string]: HookMeta;
|
|
10
|
-
|
|
11
|
-
options: {
|
|
12
|
-
id: string | undefined;
|
|
13
|
-
argv: string[];
|
|
14
|
-
};
|
|
15
|
-
return: void;
|
|
16
|
-
};
|
|
17
|
-
prerun: {
|
|
10
|
+
command_incomplete: {
|
|
18
11
|
options: {
|
|
19
|
-
Command: Command.Class;
|
|
20
12
|
argv: string[];
|
|
13
|
+
id: string;
|
|
14
|
+
matches: Command.Loadable[];
|
|
21
15
|
};
|
|
22
|
-
return:
|
|
23
|
-
};
|
|
24
|
-
postrun: {
|
|
25
|
-
options: {
|
|
26
|
-
Command: Command.Class;
|
|
27
|
-
result?: any;
|
|
28
|
-
argv: string[];
|
|
29
|
-
};
|
|
30
|
-
return: void;
|
|
31
|
-
};
|
|
32
|
-
preupdate: {
|
|
33
|
-
options: {
|
|
34
|
-
channel: string;
|
|
35
|
-
version: string;
|
|
36
|
-
};
|
|
37
|
-
return: void;
|
|
38
|
-
};
|
|
39
|
-
update: {
|
|
40
|
-
options: {
|
|
41
|
-
channel: string;
|
|
42
|
-
version: string;
|
|
43
|
-
};
|
|
44
|
-
return: void;
|
|
16
|
+
return: unknown;
|
|
45
17
|
};
|
|
46
|
-
|
|
18
|
+
command_not_found: {
|
|
47
19
|
options: {
|
|
48
|
-
id: string;
|
|
49
20
|
argv?: string[];
|
|
21
|
+
id: string;
|
|
50
22
|
};
|
|
51
23
|
return: unknown;
|
|
52
24
|
};
|
|
53
|
-
|
|
25
|
+
init: {
|
|
54
26
|
options: {
|
|
55
|
-
id: string;
|
|
56
27
|
argv: string[];
|
|
57
|
-
|
|
28
|
+
id: string | undefined;
|
|
58
29
|
};
|
|
59
|
-
return:
|
|
30
|
+
return: void;
|
|
60
31
|
};
|
|
61
|
-
|
|
32
|
+
jit_plugin_not_installed: {
|
|
62
33
|
options: {
|
|
63
|
-
id: string;
|
|
64
34
|
argv: string[];
|
|
65
35
|
command: Command.Loadable;
|
|
36
|
+
id: string;
|
|
66
37
|
pluginName: string;
|
|
67
38
|
pluginVersion: string;
|
|
68
39
|
};
|
|
@@ -75,12 +46,41 @@ export interface Hooks {
|
|
|
75
46
|
tag: string;
|
|
76
47
|
type: 'npm';
|
|
77
48
|
} | {
|
|
78
|
-
url: string;
|
|
79
49
|
type: 'repo';
|
|
50
|
+
url: string;
|
|
80
51
|
};
|
|
81
52
|
};
|
|
82
53
|
return: void;
|
|
83
54
|
};
|
|
55
|
+
postrun: {
|
|
56
|
+
options: {
|
|
57
|
+
Command: Command.Class;
|
|
58
|
+
argv: string[];
|
|
59
|
+
result?: any;
|
|
60
|
+
};
|
|
61
|
+
return: void;
|
|
62
|
+
};
|
|
63
|
+
prerun: {
|
|
64
|
+
options: {
|
|
65
|
+
Command: Command.Class;
|
|
66
|
+
argv: string[];
|
|
67
|
+
};
|
|
68
|
+
return: void;
|
|
69
|
+
};
|
|
70
|
+
preupdate: {
|
|
71
|
+
options: {
|
|
72
|
+
channel: string;
|
|
73
|
+
version: string;
|
|
74
|
+
};
|
|
75
|
+
return: void;
|
|
76
|
+
};
|
|
77
|
+
update: {
|
|
78
|
+
options: {
|
|
79
|
+
channel: string;
|
|
80
|
+
version: string;
|
|
81
|
+
};
|
|
82
|
+
return: void;
|
|
83
|
+
};
|
|
84
84
|
}
|
|
85
85
|
export type Hook<T extends keyof P, P extends Hooks = Hooks> = (this: Hook.Context, options: P[T]['options'] & {
|
|
86
86
|
config: Config;
|
|
@@ -97,24 +97,24 @@ export declare namespace Hook {
|
|
|
97
97
|
type JitPluginNotInstalled = Hook<'jit_plugin_not_installed'>;
|
|
98
98
|
interface Context {
|
|
99
99
|
config: Config;
|
|
100
|
-
|
|
101
|
-
error(message:
|
|
100
|
+
debug(...args: any[]): void;
|
|
101
|
+
error(message: Error | string, options?: {
|
|
102
102
|
code?: string;
|
|
103
103
|
exit?: number;
|
|
104
104
|
}): void;
|
|
105
|
-
|
|
105
|
+
exit(code?: number): void;
|
|
106
106
|
log(message?: any, ...args: any[]): void;
|
|
107
|
-
|
|
107
|
+
warn(message: string): void;
|
|
108
108
|
}
|
|
109
109
|
interface Result<T> {
|
|
110
|
-
successes: Array<{
|
|
111
|
-
result: T;
|
|
112
|
-
plugin: Plugin;
|
|
113
|
-
}>;
|
|
114
110
|
failures: Array<{
|
|
115
111
|
error: Error;
|
|
116
112
|
plugin: Plugin;
|
|
117
113
|
}>;
|
|
114
|
+
successes: Array<{
|
|
115
|
+
plugin: Plugin;
|
|
116
|
+
result: T;
|
|
117
|
+
}>;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export type { AlphabetLowercase, AlphabetUppercase } from './alphabet';
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
2
|
+
export type { InferredArgs } from './args';
|
|
3
|
+
export type { ArchTypes, Config, LoadOptions, PlatformTypes, PluginVersionDetail, VersionDetails } from './config';
|
|
4
|
+
export type { CommandError, OclifError, PrettyPrintableError } from './errors';
|
|
5
|
+
export type { InferredFlags } from './flags';
|
|
4
6
|
export type { HelpOptions } from './help';
|
|
5
7
|
export type { Hook, Hooks } from './hooks';
|
|
6
8
|
export type { Manifest } from './manifest';
|
|
7
|
-
export type {
|
|
8
|
-
export type { Arg, BooleanFlag, CustomOptions, Deprecation, Flag, FlagDefinition, OptionFlag, } from './parser';
|
|
9
|
+
export type { Arg, BooleanFlag, CustomOptions, Deprecation, Flag, FlagDefinition, OptionFlag } from './parser';
|
|
9
10
|
export type { PJSON } from './pjson';
|
|
10
|
-
export type { Plugin, PluginOptions
|
|
11
|
+
export type { Options, Plugin, PluginOptions } from './plugin';
|
|
12
|
+
export type { S3Manifest } from './s3-manifest';
|
|
11
13
|
export type { Topic } from './topic';
|
|
12
14
|
export type { TSConfig } from './ts-config';
|
|
13
|
-
export type { InferredFlags } from './flags';
|
|
14
|
-
export type { InferredArgs } from './args';
|