@asyncapi/cli 0.52.5 → 0.53.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.
|
@@ -3,6 +3,7 @@ export default class ContextAdd extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static flags: {
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
+
'set-current': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
7
|
};
|
|
7
8
|
static args: {
|
|
8
9
|
name: string;
|
|
@@ -8,12 +8,17 @@ const context_error_1 = require("../../../errors/context-error");
|
|
|
8
8
|
class ContextAdd extends base_1.default {
|
|
9
9
|
run() {
|
|
10
10
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const { args } = yield this.parse(ContextAdd);
|
|
11
|
+
const { args, flags } = yield this.parse(ContextAdd);
|
|
12
12
|
const contextName = args['context-name'];
|
|
13
13
|
const specFilePath = args['spec-file-path'];
|
|
14
|
+
const setAsCurrent = flags['set-current'];
|
|
14
15
|
try {
|
|
15
16
|
yield (0, Context_1.addContext)(contextName, specFilePath);
|
|
16
17
|
this.log(`Added context "${contextName}".\n\nYou can set it as your current context: asyncapi config context use ${contextName}\nYou can use this context when needed by passing ${contextName} as a parameter: asyncapi validate ${contextName}`);
|
|
18
|
+
if (setAsCurrent) {
|
|
19
|
+
yield (0, Context_1.setCurrentContext)(contextName);
|
|
20
|
+
this.log(`The newly added context "${contextName}", is set as your current context!`);
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
catch (e) {
|
|
19
24
|
if (e instanceof (context_error_1.MissingContextFileError || context_error_1.ContextFileWrongFormatError)) {
|
|
@@ -31,6 +36,12 @@ exports.default = ContextAdd;
|
|
|
31
36
|
ContextAdd.description = 'Add a context to the store';
|
|
32
37
|
ContextAdd.flags = {
|
|
33
38
|
help: core_1.Flags.help({ char: 'h' }),
|
|
39
|
+
'set-current': core_1.Flags.boolean({
|
|
40
|
+
char: 's',
|
|
41
|
+
description: 'Set context being added as the current context',
|
|
42
|
+
default: false,
|
|
43
|
+
required: false,
|
|
44
|
+
})
|
|
34
45
|
};
|
|
35
46
|
ContextAdd.args = [
|
|
36
47
|
{ name: 'context-name', description: 'context name', required: true },
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.53.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"bundle": {
|
|
5
5
|
"id": "bundle",
|
|
@@ -927,6 +927,14 @@
|
|
|
927
927
|
"char": "h",
|
|
928
928
|
"description": "Show CLI help.",
|
|
929
929
|
"allowNo": false
|
|
930
|
+
},
|
|
931
|
+
"set-current": {
|
|
932
|
+
"name": "set-current",
|
|
933
|
+
"type": "boolean",
|
|
934
|
+
"char": "s",
|
|
935
|
+
"description": "Set context being added as the current context",
|
|
936
|
+
"required": false,
|
|
937
|
+
"allowNo": false
|
|
930
938
|
}
|
|
931
939
|
},
|
|
932
940
|
"args": {
|