@celonis/content-cli 1.0.7 → 1.0.8
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/commands/configuration-management/studio.service.js +2 -1
- package/content-cli.js +7 -1
- package/core/command/CustomHelp.js +30 -0
- package/core/command/module-handler.js +30 -1
- package/lib/core/command/CustomHelp.d.ts +5 -0
- package/lib/core/command/module-handler.d.ts +4 -0
- package/package.json +1 -1
|
@@ -116,7 +116,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
fixConnectionVariable(variable) {
|
|
119
|
-
|
|
119
|
+
var _a;
|
|
120
|
+
if (!((_a = variable.value) === null || _a === void 0 ? void 0 : _a.appName)) {
|
|
120
121
|
return variable;
|
|
121
122
|
}
|
|
122
123
|
return Object.assign(Object.assign({}, variable), { metadata: Object.assign(Object.assign({}, variable.metadata), { appName: variable.value.appName }) });
|
package/content-cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
if (v !== undefined) module.exports = v;
|
|
15
15
|
}
|
|
16
16
|
else if (typeof define === "function" && define.amd) {
|
|
17
|
-
define(["require", "exports", "semver/functions/satisfies", "commander", "./core/command/module-handler", "./core/command/cli-context", "./core/utils/version", "./core/utils/logger"], factory);
|
|
17
|
+
define(["require", "exports", "semver/functions/satisfies", "commander", "./core/command/module-handler", "./core/command/cli-context", "./core/utils/version", "./core/utils/logger", "./core/command/CustomHelp"], factory);
|
|
18
18
|
}
|
|
19
19
|
})(function (require, exports) {
|
|
20
20
|
"use strict";
|
|
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
const cli_context_1 = require("./core/command/cli-context");
|
|
26
26
|
const version_1 = require("./core/utils/version");
|
|
27
27
|
const logger_1 = require("./core/utils/logger");
|
|
28
|
+
const CustomHelp_1 = require("./core/command/CustomHelp");
|
|
28
29
|
/**
|
|
29
30
|
* Celonis Content CLI.
|
|
30
31
|
*
|
|
@@ -38,6 +39,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
39
|
}
|
|
39
40
|
// Global configuration options
|
|
40
41
|
const program = new commander_1.Command();
|
|
42
|
+
program.configureHelp({
|
|
43
|
+
formatHelp: (cmd, helper) => new CustomHelp_1.ContentCLIHelp().formatHelp(cmd, helper),
|
|
44
|
+
subcommandTerm: cmd => new CustomHelp_1.ContentCLIHelp().subcommandTerm(cmd),
|
|
45
|
+
optionTerm: opt => new CustomHelp_1.ContentCLIHelp().optionTerm(opt),
|
|
46
|
+
});
|
|
41
47
|
program.version(version_1.VersionUtils.getCurrentCliVersion());
|
|
42
48
|
program.option("-q, --quietmode", "Reduce output to a minimum", false);
|
|
43
49
|
program.option("-p, --profile [profile]");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "commander", "chalk"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContentCLIHelp = void 0;
|
|
13
|
+
const commander_1 = require("commander");
|
|
14
|
+
const chalk = require("chalk");
|
|
15
|
+
class ContentCLIHelp extends commander_1.Help {
|
|
16
|
+
subcommandTerm(cmd) {
|
|
17
|
+
const base = super.subcommandTerm(cmd);
|
|
18
|
+
return cmd.isBeta === true
|
|
19
|
+
? `${base} ${chalk.yellow("(beta)")}`
|
|
20
|
+
: base;
|
|
21
|
+
}
|
|
22
|
+
optionTerm(option) {
|
|
23
|
+
const term = super.optionTerm(option);
|
|
24
|
+
return option.isBeta === true
|
|
25
|
+
? `${term} ${chalk.yellow("(beta)")}`
|
|
26
|
+
: term;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ContentCLIHelp = ContentCLIHelp;
|
|
30
|
+
});
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
if (v !== undefined) module.exports = v;
|
|
14
14
|
}
|
|
15
15
|
else if (typeof define === "function" && define.amd) {
|
|
16
|
-
define(["require", "exports", "path", "fs", "../utils/logger"], factory);
|
|
16
|
+
define(["require", "exports", "path", "fs", "commander", "../utils/logger", "chalk"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,7 +21,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
exports.CommandConfig = exports.Configurator = exports.ModuleHandler = exports.IModule = void 0;
|
|
22
22
|
const path = require("path");
|
|
23
23
|
const fs = require("fs");
|
|
24
|
+
const commander_1 = require("commander");
|
|
24
25
|
const logger_1 = require("../utils/logger");
|
|
26
|
+
const chalk = require("chalk");
|
|
25
27
|
class IModule {
|
|
26
28
|
}
|
|
27
29
|
exports.IModule = IModule;
|
|
@@ -171,6 +173,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
171
173
|
this.cmd.option(flags, description, defaultValue);
|
|
172
174
|
return this;
|
|
173
175
|
}
|
|
176
|
+
betaOption(flags, description, defaultValue) {
|
|
177
|
+
const option = new commander_1.Option(flags, description).default(defaultValue);
|
|
178
|
+
option.isBeta = true;
|
|
179
|
+
this.cmd.addOption(option);
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
174
182
|
requiredOption(flags, description, defaultValue) {
|
|
175
183
|
this.cmd.requiredOption(flags, description, defaultValue);
|
|
176
184
|
return this;
|
|
@@ -179,9 +187,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
179
187
|
this.deprecationMessage = deprecationMessage;
|
|
180
188
|
return this;
|
|
181
189
|
}
|
|
190
|
+
beta() {
|
|
191
|
+
this.cmd.isBeta = true;
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
182
194
|
action(handler) {
|
|
183
195
|
this.cmd.action(() => __awaiter(this, void 0, void 0, function* () {
|
|
184
196
|
try {
|
|
197
|
+
this.printBetaNoticeIfBetaCommand();
|
|
198
|
+
this.printBetaNoticeIfBetaOptions();
|
|
185
199
|
this.printDeprecationNoticeIfDeprecated();
|
|
186
200
|
yield handler(this.ctx, this.cmd, this.cmd.opts());
|
|
187
201
|
}
|
|
@@ -195,6 +209,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
195
209
|
logger_1.logger.warn("⚠️ [DEPRECATION NOTICE] \n" + this.deprecationMessage);
|
|
196
210
|
}
|
|
197
211
|
}
|
|
212
|
+
printBetaNoticeIfBetaCommand() {
|
|
213
|
+
if (this.cmd.isBeta) {
|
|
214
|
+
logger_1.logger.info(chalk.yellow("This command is in beta and may change in future releases."));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
printBetaNoticeIfBetaOptions() {
|
|
218
|
+
if (this.cmd.isBeta) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
for (const option of this.cmd.options) {
|
|
222
|
+
if (option.isBeta) {
|
|
223
|
+
logger_1.logger.info(chalk.yellow(`The option '${option.long}' is in beta and may change in future releases.`));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
198
227
|
}
|
|
199
228
|
exports.CommandConfig = CommandConfig;
|
|
200
229
|
});
|
|
@@ -49,9 +49,13 @@ export declare class CommandConfig {
|
|
|
49
49
|
description(description: string): CommandConfig;
|
|
50
50
|
argument(name: string, description?: string, defaultValue?: unknown): CommandConfig;
|
|
51
51
|
option(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
52
|
+
betaOption(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
52
53
|
requiredOption(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
53
54
|
deprecationNotice(deprecationMessage: string): CommandConfig;
|
|
55
|
+
beta(): CommandConfig;
|
|
54
56
|
action(handler: CommandHandler): void;
|
|
55
57
|
private printDeprecationNoticeIfDeprecated;
|
|
58
|
+
private printBetaNoticeIfBetaCommand;
|
|
59
|
+
private printBetaNoticeIfBetaOptions;
|
|
56
60
|
}
|
|
57
61
|
export {};
|