@kelceyp/caw 1.0.11 → 1.0.12
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/dist/caw.js +23 -4
- package/package.json +2 -2
package/dist/caw.js
CHANGED
|
@@ -799,7 +799,7 @@ function generateParamsTable(params, colors) {
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
const env2 = param.env || "";
|
|
802
|
-
const description = "";
|
|
802
|
+
const description = param.description || "";
|
|
803
803
|
rows.push({
|
|
804
804
|
name: param.name,
|
|
805
805
|
flags,
|
|
@@ -9677,9 +9677,11 @@ function parseCommandPath(argv) {
|
|
|
9677
9677
|
class Dispatcher {
|
|
9678
9678
|
registry;
|
|
9679
9679
|
strict;
|
|
9680
|
+
version;
|
|
9680
9681
|
constructor(app) {
|
|
9681
9682
|
this.registry = new CommandRegistry;
|
|
9682
9683
|
this.strict = app.strict ?? false;
|
|
9684
|
+
this.version = app.version;
|
|
9683
9685
|
for (const item of app.commands) {
|
|
9684
9686
|
this.registry.register(item);
|
|
9685
9687
|
}
|
|
@@ -9691,6 +9693,9 @@ class Dispatcher {
|
|
|
9691
9693
|
if (argv[0] === "--help" || argv[0] === "-h") {
|
|
9692
9694
|
return { type: "show_help" };
|
|
9693
9695
|
}
|
|
9696
|
+
if ((argv[0] === "--version" || argv[0] === "-v") && this.version) {
|
|
9697
|
+
return { type: "show_version" };
|
|
9698
|
+
}
|
|
9694
9699
|
const { commandPath, paramArgv } = parseCommandPath(argv);
|
|
9695
9700
|
if (commandPath.length === 0) {
|
|
9696
9701
|
return { type: "show_help" };
|
|
@@ -10101,6 +10106,10 @@ class AppBuilder {
|
|
|
10101
10106
|
const app = this.buildApp();
|
|
10102
10107
|
const dispatcher = new Dispatcher(app);
|
|
10103
10108
|
const result = dispatcher.dispatch(argv);
|
|
10109
|
+
if (result.type === "show_version") {
|
|
10110
|
+
console.log(app.version);
|
|
10111
|
+
process.exit(0);
|
|
10112
|
+
}
|
|
10104
10113
|
if (result.type === "show_help") {
|
|
10105
10114
|
const helpText = generateAppHelp(app);
|
|
10106
10115
|
console.log(helpText);
|
|
@@ -10168,6 +10177,7 @@ class ParamBuilder {
|
|
|
10168
10177
|
_prompt;
|
|
10169
10178
|
_validate;
|
|
10170
10179
|
_validationRules = [];
|
|
10180
|
+
_description;
|
|
10171
10181
|
name(name) {
|
|
10172
10182
|
if (!name || typeof name !== "string") {
|
|
10173
10183
|
throw new TypeError("Parameter name must be a non-empty string");
|
|
@@ -10256,6 +10266,13 @@ class ParamBuilder {
|
|
|
10256
10266
|
}
|
|
10257
10267
|
return this;
|
|
10258
10268
|
}
|
|
10269
|
+
description(text) {
|
|
10270
|
+
if (!text || typeof text !== "string" || text.trim() === "") {
|
|
10271
|
+
throw new TypeError("Description must be a non-empty string");
|
|
10272
|
+
}
|
|
10273
|
+
this._description = text;
|
|
10274
|
+
return this;
|
|
10275
|
+
}
|
|
10259
10276
|
build() {
|
|
10260
10277
|
if (!this._name) {
|
|
10261
10278
|
throw new ConfigurationError("Parameter must have a name. Call .name(string) before .build()");
|
|
@@ -10281,7 +10298,8 @@ class ParamBuilder {
|
|
|
10281
10298
|
stdin: this._stdin,
|
|
10282
10299
|
prompt: this._prompt,
|
|
10283
10300
|
validate: this._validate,
|
|
10284
|
-
validationRules: this._validationRules.length > 0 ? this._validationRules : undefined
|
|
10301
|
+
validationRules: this._validationRules.length > 0 ? this._validationRules : undefined,
|
|
10302
|
+
description: this._description
|
|
10285
10303
|
};
|
|
10286
10304
|
return param;
|
|
10287
10305
|
} else {
|
|
@@ -10297,7 +10315,8 @@ class ParamBuilder {
|
|
|
10297
10315
|
stdin: this._stdin,
|
|
10298
10316
|
prompt: this._prompt,
|
|
10299
10317
|
validate: this._validate,
|
|
10300
|
-
validationRules: this._validationRules.length > 0 ? this._validationRules : undefined
|
|
10318
|
+
validationRules: this._validationRules.length > 0 ? this._validationRules : undefined,
|
|
10319
|
+
description: this._description
|
|
10301
10320
|
};
|
|
10302
10321
|
return param;
|
|
10303
10322
|
}
|
|
@@ -11624,6 +11643,6 @@ if (!globalCheck.ok) {
|
|
|
11624
11643
|
console.error(globalCheck.message);
|
|
11625
11644
|
process.exit(1);
|
|
11626
11645
|
}
|
|
11627
|
-
var LAUNCHER_VERSION = "1.0.
|
|
11646
|
+
var LAUNCHER_VERSION = "1.0.12";
|
|
11628
11647
|
var app = create().name("caw").version(LAUNCHER_VERSION).command(start_default.create()).command(stop_default.create()).command(status_default.create()).command(logs_default.create()).command(upgrade_default.create());
|
|
11629
11648
|
await app.run(process.argv.slice(2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelceyp/caw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "CAW launcher — server lifecycle management CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts/postinstall.js"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@kelceyp/clibuilder": "^0.2.
|
|
19
|
+
"@kelceyp/clibuilder": "^0.2.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"semver": "^7"
|