@blazetrails/thor 0.0.0-stage → 0.1.0-alpha0.2
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/LICENSE +21 -0
- package/NOTICE +9 -0
- package/dist/actions/create-file.d.ts +23 -0
- package/dist/actions/create-file.js +69 -0
- package/dist/actions/create-file.js.map +1 -0
- package/dist/actions/create-link.d.ts +10 -0
- package/dist/actions/create-link.js +34 -0
- package/dist/actions/create-link.js.map +1 -0
- package/dist/actions/directory.d.ts +31 -0
- package/dist/actions/directory.js +76 -0
- package/dist/actions/directory.js.map +1 -0
- package/dist/actions/empty-directory.d.ts +36 -0
- package/dist/actions/empty-directory.js +95 -0
- package/dist/actions/empty-directory.js.map +1 -0
- package/dist/actions/file-manipulation.d.ts +64 -0
- package/dist/actions/file-manipulation.js +190 -0
- package/dist/actions/file-manipulation.js.map +1 -0
- package/dist/actions/inject-into-file.d.ts +31 -0
- package/dist/actions/inject-into-file.js +111 -0
- package/dist/actions/inject-into-file.js.map +1 -0
- package/dist/actions.d.ts +120 -0
- package/dist/actions.js +287 -0
- package/dist/actions.js.map +1 -0
- package/dist/base.d.ts +223 -0
- package/dist/base.js +455 -0
- package/dist/base.js.map +1 -0
- package/dist/command.d.ts +69 -0
- package/dist/command.js +169 -0
- package/dist/command.js.map +1 -0
- package/dist/constants.generated.d.ts +2 -0
- package/dist/constants.generated.js +74 -0
- package/dist/constants.generated.js.map +1 -0
- package/dist/core-ext/hash-with-indifferent-access.d.ts +32 -0
- package/dist/core-ext/hash-with-indifferent-access.js +99 -0
- package/dist/core-ext/hash-with-indifferent-access.js.map +1 -0
- package/dist/error.d.ts +62 -0
- package/dist/error.js +105 -0
- package/dist/error.js.map +1 -0
- package/dist/group.d.ts +66 -0
- package/dist/group.js +313 -0
- package/dist/group.js.map +1 -0
- package/dist/invocation.d.ts +63 -0
- package/dist/invocation.js +104 -0
- package/dist/invocation.js.map +1 -0
- package/dist/line-editor/basic.d.ts +12 -0
- package/dist/line-editor/basic.js +30 -0
- package/dist/line-editor/basic.js.map +1 -0
- package/dist/line-editor.d.ts +4 -0
- package/dist/line-editor.js +9 -0
- package/dist/line-editor.js.map +1 -0
- package/dist/nested-context.d.ts +12 -0
- package/dist/nested-context.js +28 -0
- package/dist/nested-context.js.map +1 -0
- package/dist/parser/argument.d.ts +34 -0
- package/dist/parser/argument.js +103 -0
- package/dist/parser/argument.js.map +1 -0
- package/dist/parser/arguments.d.ts +42 -0
- package/dist/parser/arguments.js +164 -0
- package/dist/parser/arguments.js.map +1 -0
- package/dist/parser/option.d.ts +45 -0
- package/dist/parser/option.js +164 -0
- package/dist/parser/option.js.map +1 -0
- package/dist/parser/options.d.ts +69 -0
- package/dist/parser/options.js +332 -0
- package/dist/parser/options.js.map +1 -0
- package/dist/shell/basic.d.ts +64 -0
- package/dist/shell/basic.js +288 -0
- package/dist/shell/basic.js.map +1 -0
- package/dist/shell/color.d.ts +29 -0
- package/dist/shell/color.js +52 -0
- package/dist/shell/color.js.map +1 -0
- package/dist/shell/column-printer.d.ts +16 -0
- package/dist/shell/column-printer.js +28 -0
- package/dist/shell/column-printer.js.map +1 -0
- package/dist/shell/table-printer.d.ts +31 -0
- package/dist/shell/table-printer.js +120 -0
- package/dist/shell/table-printer.js.map +1 -0
- package/dist/shell/terminal.d.ts +4 -0
- package/dist/shell/terminal.js +35 -0
- package/dist/shell/terminal.js.map +1 -0
- package/dist/shell/wrapped-printer.d.ts +5 -0
- package/dist/shell/wrapped-printer.js +37 -0
- package/dist/shell/wrapped-printer.js.map +1 -0
- package/dist/shell.d.ts +51 -0
- package/dist/shell.js +129 -0
- package/dist/shell.js.map +1 -0
- package/dist/thor.d.ts +174 -0
- package/dist/thor.js +640 -0
- package/dist/thor.js.map +1 -0
- package/dist/util.d.ts +16 -0
- package/dist/util.js +87 -0
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +55 -3
- package/README.md +0 -3
package/dist/command.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { ArgumentError, excBacktraceLocations, NoMethodError, rbCheckArity, rbFCaller, rbFSend, rbObjAsString, rbObjMethod, rbObjMethods, rbObjRespondTo, regexpEscape, rtest, sort, stringSplit, RUBY_ENGINE, RUBY_PLATFORM, strip, Struct, } from "@blazetrails/ruby-compat";
|
|
2
|
+
export class Command extends Struct.new("name", "description", "longDescription", "wrapLongDescription", "usage", "options", "optionsRelation", "ancestorName") {
|
|
3
|
+
static FILE_REGEXP = new RegExp(`^at (?:.*\\()?(?:file://)?${regexpEscape(new URL(".", import.meta.url).pathname.replace(/\/$/, ""))}`);
|
|
4
|
+
constructor(name, description, longDescription, wrapLongDescription, usage, options = null, optionsRelation = null) {
|
|
5
|
+
super(rbObjAsString(name), description, longDescription, wrapLongDescription, usage, options ?? {}, optionsRelation ?? {});
|
|
6
|
+
}
|
|
7
|
+
initializeCopy(other) {
|
|
8
|
+
super.initializeCopy(other);
|
|
9
|
+
if (rtest(other.options))
|
|
10
|
+
this.options = { ...other.options };
|
|
11
|
+
if (rtest(other.optionsRelation))
|
|
12
|
+
this.optionsRelation = { ...other.optionsRelation };
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
isHidden() {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
async run(instance, args = []) {
|
|
19
|
+
let arity = null;
|
|
20
|
+
try {
|
|
21
|
+
if (this.isPrivateMethod(instance)) {
|
|
22
|
+
return instance.constructor.handleNoCommandError(this.name);
|
|
23
|
+
}
|
|
24
|
+
else if (this.isPublicMethod(instance)) {
|
|
25
|
+
arity = rbObjMethod(instance, this.name).arity();
|
|
26
|
+
rbCheckArity(instance[this.name], args.length);
|
|
27
|
+
return await rbFSend(instance, this.name, ...args);
|
|
28
|
+
}
|
|
29
|
+
else if (this.isLocalMethod(instance, "methodMissing")) {
|
|
30
|
+
return await instance.methodMissing(this.name, ...args);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return instance.constructor.handleNoCommandError(this.name);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
if (e instanceof ArgumentError) {
|
|
38
|
+
if (this.isHandleArgumentError(instance, e, rbFCaller())) {
|
|
39
|
+
return instance.constructor.handleArgumentError(this, e, args, arity);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (e instanceof NoMethodError) {
|
|
46
|
+
if (this.isHandleNoMethodError(instance, e, rbFCaller())) {
|
|
47
|
+
return instance.constructor.handleNoCommandError(this.name);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
throw e;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
formattedUsage(klass, namespace = true, subcommand = false) {
|
|
57
|
+
let formatted = null;
|
|
58
|
+
if (rtest(this.ancestorName)) {
|
|
59
|
+
formatted = `${this.ancestorName} `;
|
|
60
|
+
}
|
|
61
|
+
else if (rtest(namespace)) {
|
|
62
|
+
namespace = klass.namespace();
|
|
63
|
+
formatted = `${namespace.replace(/^(default)/gm, "")}:`;
|
|
64
|
+
}
|
|
65
|
+
if (rtest(subcommand))
|
|
66
|
+
formatted ??= `${stringSplit(klass.namespace(), ":").at(-1)} `;
|
|
67
|
+
formatted ??= "";
|
|
68
|
+
const usage = this.usage;
|
|
69
|
+
return (usage == null ? [] : Array.isArray(usage) ? usage : [usage])
|
|
70
|
+
.map((specificUsage) => {
|
|
71
|
+
let formattedSpecificUsage = formatted;
|
|
72
|
+
formattedSpecificUsage += this.requiredArgumentsFor(klass, specificUsage);
|
|
73
|
+
formattedSpecificUsage += ` ${this.requiredOptions()}`;
|
|
74
|
+
return strip(formattedSpecificUsage);
|
|
75
|
+
})
|
|
76
|
+
.join("\n");
|
|
77
|
+
}
|
|
78
|
+
methodExclusiveOptionNames() {
|
|
79
|
+
return this.optionsRelation.exclusiveOptionNames ?? [];
|
|
80
|
+
}
|
|
81
|
+
methodAtLeastOneOptionNames() {
|
|
82
|
+
return this.optionsRelation.atLeastOneOptionNames ?? [];
|
|
83
|
+
}
|
|
84
|
+
/** @internal */
|
|
85
|
+
requiredArgumentsFor(klass, usage) {
|
|
86
|
+
if (klass != null && klass.arguments().length !== 0) {
|
|
87
|
+
return rbObjAsString(usage).replace(new RegExp(`^${this.name}`, "gm"), (match) => match +
|
|
88
|
+
" " +
|
|
89
|
+
klass
|
|
90
|
+
.arguments()
|
|
91
|
+
.map((argument) => argument.usage())
|
|
92
|
+
.filter((argumentUsage) => argumentUsage != null)
|
|
93
|
+
.join(" "));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return rbObjAsString(usage);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** @internal */
|
|
100
|
+
isNotDebugging(instance) {
|
|
101
|
+
return !(rbObjRespondTo(instance.constructor, "debugging") && rtest(instance.constructor.debugging));
|
|
102
|
+
}
|
|
103
|
+
/** @internal */
|
|
104
|
+
requiredOptions() {
|
|
105
|
+
return (this._requiredOptions ??= sort(Object.values(this.options)
|
|
106
|
+
.map((o) => (rtest(o.isRequired()) ? o.usage() : null))
|
|
107
|
+
.filter((x) => x != null)).join(" "));
|
|
108
|
+
}
|
|
109
|
+
/** @internal */
|
|
110
|
+
isPublicMethod(instance) {
|
|
111
|
+
return rbObjMethods(instance).includes(this.name);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
* @missingRailsCall privateMethods — PERMANENT
|
|
116
|
+
*/
|
|
117
|
+
isPrivateMethod(instance) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
/** @internal */
|
|
121
|
+
isLocalMethod(instance, name) {
|
|
122
|
+
return rbObjMethods(instance, false).includes(name);
|
|
123
|
+
}
|
|
124
|
+
/** @internal */
|
|
125
|
+
sansBacktrace(backtrace, caller) {
|
|
126
|
+
const saned = backtrace.filter((frame) => !(Command.FILE_REGEXP.test(frame) ||
|
|
127
|
+
(/\.java:/.test(frame) && /java/.test(RUBY_PLATFORM())) ||
|
|
128
|
+
(/^kernel\//m.test(frame) && /rbx/.test(RUBY_ENGINE()))));
|
|
129
|
+
return saned.filter((frame) => !caller.includes(frame));
|
|
130
|
+
}
|
|
131
|
+
/** @internal */
|
|
132
|
+
isHandleArgumentError(instance, error, caller) {
|
|
133
|
+
return (this.isNotDebugging(instance) &&
|
|
134
|
+
(/wrong number of arguments/.test(error.message) ||
|
|
135
|
+
/given \d*, expected \d*/.test(error.message)) &&
|
|
136
|
+
(() => {
|
|
137
|
+
const saned = this.sansBacktrace((excBacktraceLocations(error) ?? []).map((location) => location.toString()), caller);
|
|
138
|
+
return saned.length === 0 || saned.length === 1;
|
|
139
|
+
})());
|
|
140
|
+
}
|
|
141
|
+
/** @internal */
|
|
142
|
+
isHandleNoMethodError(instance, error, caller) {
|
|
143
|
+
return (this.isNotDebugging(instance) &&
|
|
144
|
+
new RegExp(`^undefined method \`${this.name}' for ${regexpEscape(rbObjAsString(instance))}$`, "m").test(error.message));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export const Task = Command;
|
|
148
|
+
export class HiddenCommand extends Command {
|
|
149
|
+
isHidden() {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export const HiddenTask = HiddenCommand;
|
|
154
|
+
export class DynamicCommand extends Command {
|
|
155
|
+
constructor(name, options = null) {
|
|
156
|
+
super(rbObjAsString(name), "A dynamically-generated command", rbObjAsString(name), null, rbObjAsString(name), options);
|
|
157
|
+
}
|
|
158
|
+
async run(instance, args = []) {
|
|
159
|
+
if (!rbObjMethods(instance).includes(this.name)) {
|
|
160
|
+
return super.run(instance, args);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return instance.constructor.handleNoCommandError(this.name);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export const DynamicTask = DynamicCommand;
|
|
168
|
+
import "./constants.generated.js";
|
|
169
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../lib/command.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,OAAO,EACP,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAW,EACX,aAAa,EACb,KAAK,EACL,MAAM,GACP,MAAM,0BAA0B,CAAC;AAmBlC,MAAM,OAAO,OAAQ,SAAQ,MAAM,CAAC,GAAG,CACrC,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,cAAc,CACf;IACC,MAAM,CAAC,WAAW,GAAG,IAAI,MAAM,CAC7B,6BAA6B,YAAY,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CACvG,CAAC;IAaF,YACE,IAAY,EACZ,WAA0B,EAC1B,eAA8B,EAC9B,mBAA4B,EAC5B,KAA+B,EAC/B,OAAO,GAAkC,IAAI,EAC7C,eAAe,GAAkD,IAAI;QAErE,KAAK,CACH,aAAa,CAAC,IAAI,CAAC,EACnB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,KAAK,EACL,OAAO,IAAI,EAAE,EACb,eAAe,IAAI,EAAE,CACtB,CAAC;IACJ,CAAC;IAEQ,cAAc,CAAC,KAAc;QACpC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,KAAK,CAAC,KAAK,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Q,CAAC;YAC7B,IAAI,MAAM,CACR,uBAAuB,IAAI,CAAC,IAAI,SAAS,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EACjF,GAAG,CACJ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CACtB,CAAC;IACJ,CAAC;CACF;AACD,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAE5B,MAAM,OAAO,aAAc,SAAQ,OAAO;IAC/B,QAAQ;QACf,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AACD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;AAExC,MAAM,OAAO,cAAe,SAAQ,OAAO;IACzC,YAAY,IAAY,EAAE,OAAO,GAAkC,IAAI;QACrE,KAAK,CACH,aAAa,CAAC,IAAI,CAAC,EACnB,iCAAiC,EACjC,aAAa,CAAC,IAAI,CAAC,EACnB,IAAI,EACJ,aAAa,CAAC,IAAI,CAAC,EACnB,OAAO,CACR,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,GAAG,CAAC,QAAkB,EAAE,IAAI,GAAc,EAAE;QACzD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,OAAO,QAAQ,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AACD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C,OAAO,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineConstants } from "@blazetrails/ruby-compat/classpath";
|
|
2
|
+
import * as m0 from "./actions.js";
|
|
3
|
+
import * as m1 from "./actions/create-file.js";
|
|
4
|
+
import * as m2 from "./actions/create-link.js";
|
|
5
|
+
import * as m3 from "./actions/directory.js";
|
|
6
|
+
import * as m4 from "./actions/empty-directory.js";
|
|
7
|
+
import * as m5 from "./actions/file-manipulation.js";
|
|
8
|
+
import * as m6 from "./actions/inject-into-file.js";
|
|
9
|
+
import * as m7 from "./base.js";
|
|
10
|
+
import * as m8 from "./command.js";
|
|
11
|
+
import * as m9 from "./core-ext/hash-with-indifferent-access.js";
|
|
12
|
+
import * as m10 from "./error.js";
|
|
13
|
+
import * as m11 from "./group.js";
|
|
14
|
+
import * as m12 from "./invocation.js";
|
|
15
|
+
import * as m13 from "./line-editor.js";
|
|
16
|
+
import * as m14 from "./line-editor/basic.js";
|
|
17
|
+
import * as m15 from "./nested-context.js";
|
|
18
|
+
import * as m16 from "./parser/argument.js";
|
|
19
|
+
import * as m17 from "./parser/arguments.js";
|
|
20
|
+
import * as m18 from "./parser/option.js";
|
|
21
|
+
import * as m19 from "./parser/options.js";
|
|
22
|
+
import * as m20 from "./shell.js";
|
|
23
|
+
import * as m21 from "./shell/basic.js";
|
|
24
|
+
import * as m22 from "./shell/color.js";
|
|
25
|
+
import * as m23 from "./shell/column-printer.js";
|
|
26
|
+
import * as m24 from "./shell/table-printer.js";
|
|
27
|
+
import * as m25 from "./shell/terminal.js";
|
|
28
|
+
import * as m26 from "./shell/wrapped-printer.js";
|
|
29
|
+
import * as m27 from "./util.js";
|
|
30
|
+
defineConstants([
|
|
31
|
+
[() => m0, "Actions", "Thor::Actions"],
|
|
32
|
+
[() => m5, "CapturableERB", "Thor::Actions::CapturableERB"],
|
|
33
|
+
[() => m0, "ClassMethods", "Thor::Actions::ClassMethods"],
|
|
34
|
+
[() => m1, "CreateFile", "Thor::Actions::CreateFile"],
|
|
35
|
+
[() => m2, "CreateLink", "Thor::Actions::CreateLink"],
|
|
36
|
+
[() => m3, "Directory", "Thor::Actions::Directory"],
|
|
37
|
+
[() => m4, "EmptyDirectory", "Thor::Actions::EmptyDirectory"],
|
|
38
|
+
[() => m6, "InjectIntoFile", "Thor::Actions::InjectIntoFile"],
|
|
39
|
+
[() => m10, "AmbiguousCommandError", "Thor::AmbiguousCommandError"],
|
|
40
|
+
[() => m16, "Argument", "Thor::Argument"],
|
|
41
|
+
[() => m17, "Arguments", "Thor::Arguments"],
|
|
42
|
+
[() => m10, "AtLeastOneRequiredArgumentError", "Thor::AtLeastOneRequiredArgumentError"],
|
|
43
|
+
[() => m7, "Base", "Thor::Base"],
|
|
44
|
+
[() => m7, "ClassMethods", "Thor::Base::ClassMethods"],
|
|
45
|
+
[() => m8, "Command", "Thor::Command"],
|
|
46
|
+
[() => m9, "CoreExt", "Thor::CoreExt"],
|
|
47
|
+
[() => m9, "HashWithIndifferentAccess", "Thor::CoreExt::HashWithIndifferentAccess"],
|
|
48
|
+
[() => m8, "DynamicCommand", "Thor::DynamicCommand"],
|
|
49
|
+
[() => m10, "Error", "Thor::Error"],
|
|
50
|
+
[() => m10, "ExclusiveArgumentError", "Thor::ExclusiveArgumentError"],
|
|
51
|
+
[() => m11, "Group", "Thor::Group"],
|
|
52
|
+
[() => m8, "HiddenCommand", "Thor::HiddenCommand"],
|
|
53
|
+
[() => m12, "Invocation", "Thor::Invocation"],
|
|
54
|
+
[() => m12, "ClassMethods", "Thor::Invocation::ClassMethods"],
|
|
55
|
+
[() => m10, "InvocationError", "Thor::InvocationError"],
|
|
56
|
+
[() => m13, null, "Thor::LineEditor"],
|
|
57
|
+
[() => m14, "Basic", "Thor::LineEditor::Basic"],
|
|
58
|
+
[() => m10, "MalformattedArgumentError", "Thor::MalformattedArgumentError"],
|
|
59
|
+
[() => m15, "NestedContext", "Thor::NestedContext"],
|
|
60
|
+
[() => m18, "Option", "Thor::Option"],
|
|
61
|
+
[() => m19, "Options", "Thor::Options"],
|
|
62
|
+
[() => m10, "RequiredArgumentMissingError", "Thor::RequiredArgumentMissingError"],
|
|
63
|
+
[() => m20, "Shell", "Thor::Shell"],
|
|
64
|
+
[() => m21, "Basic", "Thor::Shell::Basic"],
|
|
65
|
+
[() => m22, "Color", "Thor::Shell::Color"],
|
|
66
|
+
[() => m23, "ColumnPrinter", "Thor::Shell::ColumnPrinter"],
|
|
67
|
+
[() => m24, "TablePrinter", "Thor::Shell::TablePrinter"],
|
|
68
|
+
[() => m25, null, "Thor::Shell::Terminal"],
|
|
69
|
+
[() => m26, "WrappedPrinter", "Thor::Shell::WrappedPrinter"],
|
|
70
|
+
[() => m10, "UndefinedCommandError", "Thor::UndefinedCommandError"],
|
|
71
|
+
[() => m10, "UnknownArgumentError", "Thor::UnknownArgumentError"],
|
|
72
|
+
[() => m27, null, "Thor::Util"],
|
|
73
|
+
]);
|
|
74
|
+
//# sourceMappingURL=constants.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.generated.js","sourceRoot":"","sources":["../lib/constants.generated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,4CAA4C,CAAC;AACjE,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,GAAG,M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Access<T[keyof T]> & Readonly<T> & {
|
|
4
|
+
readonly [K in keyof T & string as `is${Capitalize<K>}`]: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare class HashWithIndifferentAccess<V = unknown> extends Hash<string, V> {
|
|
7
|
+
constructor(hash?: AnyHash<V>);
|
|
8
|
+
get(key: string): V | undefined;
|
|
9
|
+
set(key: string, value: V): this;
|
|
10
|
+
delete(key: string): ReturnType<Hash<string, V>["delete"]>;
|
|
11
|
+
except(...keys: string[]): this;
|
|
12
|
+
fetch(key: string, ...args: unknown[]): unknown;
|
|
13
|
+
slice(...keys: string[]): Hash<string, V>;
|
|
14
|
+
hasKey(key: string): boolean;
|
|
15
|
+
valuesAt(...indices: string[]): (V | undefined)[];
|
|
16
|
+
merge(other: AnyHash<V>): this;
|
|
17
|
+
mergeBang(other: AnyHash<V>): this;
|
|
18
|
+
reverseMerge(other: AnyHash<V>): this;
|
|
19
|
+
reverseMergeBang(otherHash: AnyHash<V>): this;
|
|
20
|
+
replace(otherHash: Map<string, V>): this;
|
|
21
|
+
toHash(): Hash<string, V>;
|
|
22
|
+
/** @internal */
|
|
23
|
+
protected convertKey(key: string): string;
|
|
24
|
+
/** @internal */
|
|
25
|
+
protected methodMissing(method: string, ...args: unknown[]): unknown;
|
|
26
|
+
}
|
|
27
|
+
export declare const CoreExt: {
|
|
28
|
+
HashWithIndifferentAccess: typeof HashWithIndifferentAccess;
|
|
29
|
+
};
|
|
30
|
+
import "../constants.generated.js";
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=hash-with-indifferent-access.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Hash, dup, eachPair, fetch, isSymbol, mergeBang, rbEqual, rtest, slice, symbolToS, } from "@blazetrails/ruby-compat";
|
|
2
|
+
export class HashWithIndifferentAccess extends Hash {
|
|
3
|
+
static {
|
|
4
|
+
Object.setPrototypeOf(this.prototype, new Proxy(Object.create(Hash.prototype), {
|
|
5
|
+
get(target, method, receiver) {
|
|
6
|
+
if (typeof method === "symbol" || method in target) {
|
|
7
|
+
return Reflect.get(target, method, receiver);
|
|
8
|
+
}
|
|
9
|
+
const predicate = /^is([A-Z])(\w*)$/.exec(method);
|
|
10
|
+
return receiver.methodMissing(predicate ? `${predicate[1].toLowerCase()}${predicate[2]}?` : method);
|
|
11
|
+
},
|
|
12
|
+
set(target, method, value, receiver) {
|
|
13
|
+
if (typeof method === "symbol" || method in target) {
|
|
14
|
+
return Reflect.set(target, method, value, receiver);
|
|
15
|
+
}
|
|
16
|
+
receiver.set(method, value);
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
constructor(hash = {}) {
|
|
22
|
+
super();
|
|
23
|
+
// eslint-disable-next-line blazetrails/ruby-compat-native-required -- hash may be a Hash, which eachPair dispatches on
|
|
24
|
+
eachPair(hash, (key, value) => {
|
|
25
|
+
this.set(this.convertKey(key), value);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
get(key) {
|
|
29
|
+
const value = super.get(this.convertKey(key));
|
|
30
|
+
return (value === undefined ? null : value);
|
|
31
|
+
}
|
|
32
|
+
set(key, value) {
|
|
33
|
+
return super.set(this.convertKey(key), value);
|
|
34
|
+
}
|
|
35
|
+
delete(key) {
|
|
36
|
+
return super.delete(this.convertKey(key));
|
|
37
|
+
}
|
|
38
|
+
except(...keys) {
|
|
39
|
+
const hash = dup(this);
|
|
40
|
+
keys.forEach((key) => hash.delete(this.convertKey(key)));
|
|
41
|
+
return hash;
|
|
42
|
+
}
|
|
43
|
+
fetch(key, ...args) {
|
|
44
|
+
return fetch(this, this.convertKey(key), ...args);
|
|
45
|
+
}
|
|
46
|
+
slice(...keys) {
|
|
47
|
+
return slice(this, ...keys.map((key) => this.convertKey(key)));
|
|
48
|
+
}
|
|
49
|
+
hasKey(key) {
|
|
50
|
+
return super.has(this.convertKey(key));
|
|
51
|
+
}
|
|
52
|
+
valuesAt(...indices) {
|
|
53
|
+
return indices.map((key) => this.get(this.convertKey(key)));
|
|
54
|
+
}
|
|
55
|
+
merge(other) {
|
|
56
|
+
return dup(this).mergeBang(other);
|
|
57
|
+
}
|
|
58
|
+
mergeBang(other) {
|
|
59
|
+
// eslint-disable-next-line blazetrails/ruby-compat-native-required -- other may be a Hash, which eachPair dispatches on
|
|
60
|
+
eachPair(other, (key, value) => {
|
|
61
|
+
this.set(this.convertKey(key), value);
|
|
62
|
+
});
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
reverseMerge(other) {
|
|
66
|
+
return new this.constructor(other).merge(this);
|
|
67
|
+
}
|
|
68
|
+
reverseMergeBang(otherHash) {
|
|
69
|
+
return this.replace(this.reverseMerge(otherHash));
|
|
70
|
+
}
|
|
71
|
+
replace(otherHash) {
|
|
72
|
+
return super.replace(otherHash);
|
|
73
|
+
}
|
|
74
|
+
toHash() {
|
|
75
|
+
return mergeBang(new Hash(this.default()), this);
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
convertKey(key) {
|
|
79
|
+
return isSymbol(key) ? symbolToS(key) : key;
|
|
80
|
+
}
|
|
81
|
+
/** @internal */
|
|
82
|
+
methodMissing(method, ...args) {
|
|
83
|
+
const match = /^(\w+)\?$/.exec(method);
|
|
84
|
+
if (match) {
|
|
85
|
+
if (args.length === 0) {
|
|
86
|
+
return rtest(this.get(match[1]));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return rbEqual(this.get(match[1]), args[0]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return this.get(method);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export const CoreExt = { HashWithIndifferentAccess };
|
|
98
|
+
import "../constants.generated.js";
|
|
99
|
+
//# sourceMappingURL=hash-with-indifferent-access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash-with-indifferent-access.js","sourceRoot":"","sources":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E,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,gBAAgB;IACN,UAAU,CAAC,GAAW;QAC9B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9C,CAAC;IAED,gBAAgB;IACN,aAAa,CAAC,MAAc,EAAE,GAAG,IAAe;QACxD,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,yBAAyB,EAAE,CAAC;AAErD,OAAO,2BAA2B,CAAC"}
|
package/dist/error.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SpellChecker as DidYouMeanSpellChecker } from "@blazetrails/did-you-mean";
|
|
2
|
+
import { StandardError } from "@blazetrails/ruby-compat";
|
|
3
|
+
interface Corrected {
|
|
4
|
+
_corrections?: string[];
|
|
5
|
+
corrections(): string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const Correctable: {
|
|
8
|
+
toString(this: Corrected): string;
|
|
9
|
+
corrections(this: Corrected): string[];
|
|
10
|
+
};
|
|
11
|
+
export declare class Error extends StandardError {
|
|
12
|
+
}
|
|
13
|
+
export declare class UndefinedCommandError extends Error {
|
|
14
|
+
readonly command: string;
|
|
15
|
+
readonly allCommands: string[];
|
|
16
|
+
corrections: () => string[];
|
|
17
|
+
constructor(command: string, allCommands: string[], namespace: string | null);
|
|
18
|
+
}
|
|
19
|
+
export declare namespace UndefinedCommandError {
|
|
20
|
+
class SpellChecker {
|
|
21
|
+
readonly error: UndefinedCommandError;
|
|
22
|
+
/** @internal */
|
|
23
|
+
private _corrections?;
|
|
24
|
+
constructor(error: UndefinedCommandError);
|
|
25
|
+
corrections(): string[];
|
|
26
|
+
spellChecker(): DidYouMeanSpellChecker;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export declare const UndefinedTaskError: typeof UndefinedCommandError;
|
|
30
|
+
export declare class AmbiguousCommandError extends Error {
|
|
31
|
+
}
|
|
32
|
+
export declare const AmbiguousTaskError: typeof AmbiguousCommandError;
|
|
33
|
+
export declare class InvocationError extends Error {
|
|
34
|
+
}
|
|
35
|
+
export declare class UnknownArgumentError extends Error {
|
|
36
|
+
readonly switches: string[];
|
|
37
|
+
readonly unknown: string[];
|
|
38
|
+
corrections: () => string[];
|
|
39
|
+
constructor(switches: string[], unknown: string[]);
|
|
40
|
+
}
|
|
41
|
+
export declare namespace UnknownArgumentError {
|
|
42
|
+
class SpellChecker {
|
|
43
|
+
readonly error: UnknownArgumentError;
|
|
44
|
+
/** @internal */
|
|
45
|
+
private _corrections?;
|
|
46
|
+
/** @internal */
|
|
47
|
+
private _spellChecker?;
|
|
48
|
+
constructor(error: UnknownArgumentError);
|
|
49
|
+
corrections(): string[];
|
|
50
|
+
spellChecker(): DidYouMeanSpellChecker;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export declare class RequiredArgumentMissingError extends InvocationError {
|
|
54
|
+
}
|
|
55
|
+
export declare class MalformattedArgumentError extends InvocationError {
|
|
56
|
+
}
|
|
57
|
+
export declare class ExclusiveArgumentError extends InvocationError {
|
|
58
|
+
}
|
|
59
|
+
export declare class AtLeastOneRequiredArgumentError extends InvocationError {
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=error.d.ts.map
|
package/dist/error.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { formatter, SpellChecker as DidYouMeanSpellChecker } from "@blazetrails/did-you-mean";
|
|
2
|
+
import { prepend, rbCallSuper, rbInspect, StandardError } from "@blazetrails/ruby-compat";
|
|
3
|
+
export const Correctable = {
|
|
4
|
+
toString() {
|
|
5
|
+
return (rbCallSuper(this, Correctable.toString) +
|
|
6
|
+
formatter().messageFor(this.corrections()));
|
|
7
|
+
},
|
|
8
|
+
corrections() {
|
|
9
|
+
const { SpellChecker } = this.constructor;
|
|
10
|
+
return (this._corrections ??= new SpellChecker(this).corrections());
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export class Error extends StandardError {
|
|
14
|
+
}
|
|
15
|
+
Error.prototype.name = "Thor::Error";
|
|
16
|
+
export class UndefinedCommandError extends Error {
|
|
17
|
+
command;
|
|
18
|
+
allCommands;
|
|
19
|
+
constructor(command, allCommands, namespace) {
|
|
20
|
+
let message = `Could not find command ${rbInspect(command)}`;
|
|
21
|
+
message =
|
|
22
|
+
namespace != null ? `${message} in ${rbInspect(namespace)} namespace.` : `${message}.`;
|
|
23
|
+
super(message);
|
|
24
|
+
this.command = command;
|
|
25
|
+
this.allCommands = allCommands;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace -- Ruby nests `class SpellChecker` inside `class UndefinedCommandError` (`error.rb:25-39`), and two same-named nested classes in one file need the class's own namespace.
|
|
29
|
+
(function (UndefinedCommandError) {
|
|
30
|
+
class SpellChecker {
|
|
31
|
+
error;
|
|
32
|
+
/** @internal */
|
|
33
|
+
_corrections;
|
|
34
|
+
constructor(error) {
|
|
35
|
+
this.error = error;
|
|
36
|
+
}
|
|
37
|
+
corrections() {
|
|
38
|
+
return (this._corrections ??= this.spellChecker()
|
|
39
|
+
.correct(this.error.command)
|
|
40
|
+
.map((correction) => rbInspect(correction)));
|
|
41
|
+
}
|
|
42
|
+
spellChecker() {
|
|
43
|
+
return new DidYouMeanSpellChecker({ dictionary: this.error.allCommands });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
UndefinedCommandError.SpellChecker = SpellChecker;
|
|
47
|
+
})(UndefinedCommandError || (UndefinedCommandError = {}));
|
|
48
|
+
UndefinedCommandError.prototype.name = "Thor::UndefinedCommandError";
|
|
49
|
+
prepend(UndefinedCommandError, Correctable);
|
|
50
|
+
export const UndefinedTaskError = UndefinedCommandError;
|
|
51
|
+
export class AmbiguousCommandError extends Error {
|
|
52
|
+
}
|
|
53
|
+
AmbiguousCommandError.prototype.name = "Thor::AmbiguousCommandError";
|
|
54
|
+
export const AmbiguousTaskError = AmbiguousCommandError;
|
|
55
|
+
export class InvocationError extends Error {
|
|
56
|
+
}
|
|
57
|
+
InvocationError.prototype.name = "Thor::InvocationError";
|
|
58
|
+
export class UnknownArgumentError extends Error {
|
|
59
|
+
switches;
|
|
60
|
+
unknown;
|
|
61
|
+
constructor(switches, unknown) {
|
|
62
|
+
super(`Unknown switches ${unknown.map((u) => rbInspect(u)).join(", ")}`);
|
|
63
|
+
this.switches = switches;
|
|
64
|
+
this.unknown = unknown;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace -- Ruby nests `class SpellChecker` inside `class UnknownArgumentError` (`error.rb:66-81`), and two same-named nested classes in one file need the class's own namespace.
|
|
68
|
+
(function (UnknownArgumentError) {
|
|
69
|
+
class SpellChecker {
|
|
70
|
+
error;
|
|
71
|
+
/** @internal */
|
|
72
|
+
_corrections;
|
|
73
|
+
/** @internal */
|
|
74
|
+
_spellChecker;
|
|
75
|
+
constructor(error) {
|
|
76
|
+
this.error = error;
|
|
77
|
+
}
|
|
78
|
+
corrections() {
|
|
79
|
+
return (this._corrections ??= [
|
|
80
|
+
...new Set(this.error.unknown.flatMap((unknown) => this.spellChecker().correct(unknown))),
|
|
81
|
+
].map((correction) => rbInspect(correction)));
|
|
82
|
+
}
|
|
83
|
+
spellChecker() {
|
|
84
|
+
return (this._spellChecker ??= new DidYouMeanSpellChecker({
|
|
85
|
+
dictionary: this.error.switches,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
UnknownArgumentError.SpellChecker = SpellChecker;
|
|
90
|
+
})(UnknownArgumentError || (UnknownArgumentError = {}));
|
|
91
|
+
UnknownArgumentError.prototype.name = "Thor::UnknownArgumentError";
|
|
92
|
+
prepend(UnknownArgumentError, Correctable);
|
|
93
|
+
export class RequiredArgumentMissingError extends InvocationError {
|
|
94
|
+
}
|
|
95
|
+
RequiredArgumentMissingError.prototype.name = "Thor::RequiredArgumentMissingError";
|
|
96
|
+
export class MalformattedArgumentError extends InvocationError {
|
|
97
|
+
}
|
|
98
|
+
MalformattedArgumentError.prototype.name = "Thor::MalformattedArgumentError";
|
|
99
|
+
export class ExclusiveArgumentError extends InvocationError {
|
|
100
|
+
}
|
|
101
|
+
ExclusiveArgumentError.prototype.name = "Thor::ExclusiveArgumentError";
|
|
102
|
+
export class AtLeastOneRequiredArgumentError extends InvocationError {
|
|
103
|
+
}
|
|
104
|
+
AtLeastOneRequiredArgumentError.prototype.name = "Thor::AtLeastOneRequiredArgumentError";
|
|
105
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../lib/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAO1F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ;QACN,OAAO,CACJ,WAAW,CAAC,IAAI,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|
+
import { Base, type BaseClass, type BaseConfig } from "./base.js";
|
|
2
|
+
import { Command, DynamicCommand } from "./command.js";
|
|
3
|
+
import type { Invocation } from "./invocation.js";
|
|
4
|
+
import type { Option } from "./parser/option.js";
|
|
5
|
+
import type { Shell } from "./shell.js";
|
|
6
|
+
import type { Basic } from "./shell/basic.js";
|
|
7
|
+
type InvocationBlock = (...args: never[]) => unknown;
|
|
8
|
+
type OptionGroups = Map<string | null, Option[]>;
|
|
9
|
+
type Instance = Base & Invocation & Shell & Group;
|
|
10
|
+
export type GroupClass = typeof Group & Omit<BaseClass, keyof typeof Group> & {
|
|
11
|
+
prepareForInvocation(key: unknown, name: unknown): unknown;
|
|
12
|
+
};
|
|
13
|
+
export declare class Group {
|
|
14
|
+
/** @internal */
|
|
15
|
+
static _desc?: string | null;
|
|
16
|
+
/** @internal */
|
|
17
|
+
static _invocations?: Map<unknown, boolean>;
|
|
18
|
+
/** @internal */
|
|
19
|
+
static _invocationBlocks?: Map<unknown, InvocationBlock>;
|
|
20
|
+
static desc(this: GroupClass, description?: string | null): string | null;
|
|
21
|
+
static help(this: GroupClass, shell: Basic): Promise<void>;
|
|
22
|
+
static invocations(this: GroupClass): Map<unknown, boolean>;
|
|
23
|
+
static invocationBlocks(this: GroupClass): Map<unknown, InvocationBlock>;
|
|
24
|
+
static invoke(this: GroupClass, ...names: unknown[]): void;
|
|
25
|
+
static invokeFromOption(this: GroupClass, ...names: unknown[]): void;
|
|
26
|
+
static removeInvocation(this: GroupClass, ...names: string[]): void;
|
|
27
|
+
static classOptionsHelp(this: GroupClass, shell: Basic, groups?: OptionGroups): Promise<void>;
|
|
28
|
+
static getOptionsFromInvocations(this: GroupClass, groupOptions: OptionGroups, baseOptions: Record<string, Option>, block?: (klass: GroupClass) => Promise<void>): Promise<void>;
|
|
29
|
+
static printableCommands(this: GroupClass, ..._: unknown[]): Promise<string[][]>;
|
|
30
|
+
static printableTasks: typeof Group.printableCommands;
|
|
31
|
+
static handleArgumentError(this: GroupClass, command: Command, error: Error, _args: unknown[], arity: number): never;
|
|
32
|
+
/** @inventedArm kebabCase — PERMANENT */
|
|
33
|
+
static isCommandExists(this: GroupClass, commandName: string): boolean;
|
|
34
|
+
/** @internal */
|
|
35
|
+
static dispatch(this: GroupClass, command: string | null | undefined, givenArgs: unknown[], givenOpts: unknown[] | Record<string, unknown> | null, config: BaseConfig, block?: (instance: Instance) => void): Promise<unknown>;
|
|
36
|
+
/** @internal */
|
|
37
|
+
static banner(this: GroupClass): string;
|
|
38
|
+
/** @internal */
|
|
39
|
+
static selfCommand(this: GroupClass): DynamicCommand;
|
|
40
|
+
/** @internal */
|
|
41
|
+
static selfTask: typeof Group.selfCommand;
|
|
42
|
+
/** @internal */
|
|
43
|
+
static baseclass(this: GroupClass): typeof Group;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
* @inventedArm kebabCase — PERMANENT
|
|
47
|
+
*/
|
|
48
|
+
static createCommand(this: GroupClass, meth: string): boolean;
|
|
49
|
+
/** @internal */
|
|
50
|
+
static createTask: typeof Group.createCommand;
|
|
51
|
+
/**
|
|
52
|
+
* @inlinedFrom Thor::Shell#initialize thor/v1.4.0/lib/thor/shell.rb:44-48
|
|
53
|
+
* @inlinedFrom Thor::Invocation#initialize thor/v1.4.0/lib/thor/invocation.rb:23-27
|
|
54
|
+
* @inlinedFrom Thor::Base#initialize thor/v1.4.0/lib/thor/base.rb:53-113
|
|
55
|
+
* @inventedArm if — PERMANENT
|
|
56
|
+
*/
|
|
57
|
+
constructor(args?: unknown[], localOptions?: unknown, config?: BaseConfig & {
|
|
58
|
+
behavior?: string | null;
|
|
59
|
+
destinationRoot?: string | null;
|
|
60
|
+
shell?: Basic | null;
|
|
61
|
+
});
|
|
62
|
+
/** @internal */
|
|
63
|
+
protected _invokeForClassMethod(this: Instance, klass: unknown, command?: unknown, ...args: unknown[]): unknown;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=group.d.ts.map
|