@alcyone-labs/arg-parser 2.13.0 → 2.13.1
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 +16 -6
- package/dist/core/ArgParserBase.d.ts.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.mjs +21 -21
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.min.mjs
CHANGED
|
@@ -3002,7 +3002,7 @@ class G {
|
|
|
3002
3002
|
};
|
|
3003
3003
|
#d;
|
|
3004
3004
|
#b = !1;
|
|
3005
|
-
#
|
|
3005
|
+
#l;
|
|
3006
3006
|
#p = !0;
|
|
3007
3007
|
#m = !0;
|
|
3008
3008
|
#y;
|
|
@@ -3023,7 +3023,7 @@ class G {
|
|
|
3023
3023
|
#g = new sr();
|
|
3024
3024
|
// Working directory management
|
|
3025
3025
|
/** The effective working directory for this parser instance */
|
|
3026
|
-
#
|
|
3026
|
+
#c = null;
|
|
3027
3027
|
/** The original root path from user's CLI invocation */
|
|
3028
3028
|
#f = null;
|
|
3029
3029
|
/** Tracks if effective working directory has been resolved */
|
|
@@ -3034,7 +3034,7 @@ class G {
|
|
|
3034
3034
|
throwForDuplicateFlags: this.#b
|
|
3035
3035
|
},
|
|
3036
3036
|
t || []
|
|
3037
|
-
), this.#p = e.handleErrors ?? !0, this.#m = e.autoExit ?? !0, this.#u = e.inheritParentFlags ?? !1, this.#v = e.triggerAutoHelpIfNoHandler ?? !1, this.#
|
|
3037
|
+
), this.#p = e.handleErrors ?? !0, this.#m = e.autoExit ?? !0, this.#u = e.inheritParentFlags ?? !1, this.#v = e.triggerAutoHelpIfNoHandler ?? !1, this.#l = e.description, this.#d = e.handler, this.#o = e.appCommandName, this.#e = e.logger || ne({
|
|
3038
3038
|
prefix: this.#t,
|
|
3039
3039
|
mcpMode: !1
|
|
3040
3040
|
});
|
|
@@ -3078,7 +3078,7 @@ class G {
|
|
|
3078
3078
|
return this.#n;
|
|
3079
3079
|
}
|
|
3080
3080
|
getDescription() {
|
|
3081
|
-
return this.#
|
|
3081
|
+
return this.#l;
|
|
3082
3082
|
}
|
|
3083
3083
|
getAutoExit() {
|
|
3084
3084
|
return this.#m;
|
|
@@ -3204,7 +3204,7 @@ class G {
|
|
|
3204
3204
|
throw new Error(
|
|
3205
3205
|
`Parser for subcommand '${e.name}' is not an instance of ArgParserBase. Please provide 'new ArgParserBase(...)' for the 'parser' property of an ISubCommand.`
|
|
3206
3206
|
);
|
|
3207
|
-
if (t.#y = this, t.#n = e.name, !t.#o && this.#o && (t.#o = this.#o), t.#m = this.#m, t.#v = this.#v, t.#u === !0 || t.#u === Ie.DirectParentOnly || t.#u === Ie.AllParents) {
|
|
3207
|
+
if (t.#y = this, t.#n = e.name, !t.#o && this.#o && (t.#o = this.#o), e.description && (t.#l = e.description), t.#m = this.#m, t.#v = this.#v, t.#u === !0 || t.#u === Ie.DirectParentOnly || t.#u === Ie.AllParents) {
|
|
3208
3208
|
const n = this.#r.flags;
|
|
3209
3209
|
for (const o of n)
|
|
3210
3210
|
t.#r.hasFlag(o.name) || t.#r._setProcessedFlagForInheritance(o);
|
|
@@ -3312,7 +3312,7 @@ class G {
|
|
|
3312
3312
|
const u = e[c + 1];
|
|
3313
3313
|
if (!u || u.startsWith("-")) continue;
|
|
3314
3314
|
const f = w.resolve(
|
|
3315
|
-
this.#
|
|
3315
|
+
this.#c || this.#f,
|
|
3316
3316
|
u
|
|
3317
3317
|
);
|
|
3318
3318
|
if (!C.existsSync(f)) {
|
|
@@ -3359,7 +3359,7 @@ class G {
|
|
|
3359
3359
|
e,
|
|
3360
3360
|
r ? [this, r] : [this]
|
|
3361
3361
|
);
|
|
3362
|
-
this.#
|
|
3362
|
+
this.#c = n, this.#f = o, this.#$ = !0;
|
|
3363
3363
|
const s = !this.#y && !!this.#o;
|
|
3364
3364
|
if (e.length === 0 && s && !this.#d && !t?.skipHelpHandling)
|
|
3365
3365
|
return this.#e.info(this.helpText()), this._handleExit(0, "Help displayed", "help");
|
|
@@ -3373,19 +3373,19 @@ class G {
|
|
|
3373
3373
|
const a = e.findIndex((p) => p === "--s-with-env");
|
|
3374
3374
|
if (a !== -1) {
|
|
3375
3375
|
let p = null, $;
|
|
3376
|
-
if ($ = this.#$ && this.#
|
|
3376
|
+
if ($ = this.#$ && this.#c !== this.#f && a + 1 >= e.length, a + 1 < e.length) {
|
|
3377
3377
|
const g = e[a + 1];
|
|
3378
3378
|
if (g && !g.startsWith("-")) {
|
|
3379
|
-
const h = this.#
|
|
3379
|
+
const h = this.#c || process.cwd();
|
|
3380
3380
|
p = w.resolve(h, g);
|
|
3381
3381
|
} else if ($) {
|
|
3382
|
-
const h = this.#
|
|
3382
|
+
const h = this.#c || process.cwd();
|
|
3383
3383
|
p = this.#i.discoverEnvFile(h), p || (console.warn(
|
|
3384
3384
|
"Warning: No .env file found in working directory. Continuing without environment configuration."
|
|
3385
3385
|
), e.splice(a, 1));
|
|
3386
3386
|
}
|
|
3387
3387
|
} else if ($) {
|
|
3388
|
-
const g = this.#
|
|
3388
|
+
const g = this.#c || process.cwd();
|
|
3389
3389
|
p = this.#i.discoverEnvFile(g), console.warn(p ? `Auto-discovered env file: ${p}` : "Warning: No .env file found in working directory. Continuing without environment configuration.");
|
|
3390
3390
|
}
|
|
3391
3391
|
if (p)
|
|
@@ -3424,7 +3424,7 @@ class G {
|
|
|
3424
3424
|
);
|
|
3425
3425
|
}
|
|
3426
3426
|
if ($) {
|
|
3427
|
-
const g = this.#
|
|
3427
|
+
const g = this.#c || process.cwd();
|
|
3428
3428
|
p = this.#i.discoverEnvFile(g), console.warn(p ? `Auto-discovered env file: ${p}` : "Warning: No .env file found in working directory. Continuing without environment configuration.");
|
|
3429
3429
|
}
|
|
3430
3430
|
if (p)
|
|
@@ -3460,16 +3460,16 @@ class G {
|
|
|
3460
3460
|
"error"
|
|
3461
3461
|
);
|
|
3462
3462
|
}
|
|
3463
|
-
if ($ = this.#$ && this.#
|
|
3464
|
-
const g = this.#
|
|
3463
|
+
if ($ = this.#$ && this.#c !== this.#f && a + 1 >= e.length, $) {
|
|
3464
|
+
const g = this.#c || process.cwd();
|
|
3465
3465
|
p = this.#i.discoverEnvFile(g), console.warn(p ? `Auto-discovered env file: ${p}` : "Warning: No .env file found in working directory. Continuing without environment configuration."), p || e.splice(a, 1);
|
|
3466
3466
|
}
|
|
3467
3467
|
}
|
|
3468
3468
|
const l = e.some(
|
|
3469
3469
|
(p) => p === "--s-with-env"
|
|
3470
3470
|
);
|
|
3471
|
-
if (this.#$ && this.#
|
|
3472
|
-
const p = this.#
|
|
3471
|
+
if (this.#$ && this.#c !== this.#f && !l) {
|
|
3472
|
+
const p = this.#c || process.cwd(), $ = this.#i.discoverEnvFile(p);
|
|
3473
3473
|
if ($) {
|
|
3474
3474
|
console.warn(`Auto-discovered env file: ${$}`), Pt.config({
|
|
3475
3475
|
path: $,
|
|
@@ -4050,7 +4050,7 @@ Arguments Remaining After Simulation:`)
|
|
|
4050
4050
|
let c = `${e(`${l} Help`)} (${this.#a.mandatoryCharacter} = Mandatory fields):
|
|
4051
4051
|
|
|
4052
4052
|
`;
|
|
4053
|
-
this.#
|
|
4053
|
+
this.#l && (c += `${r(this.#l)}
|
|
4054
4054
|
|
|
4055
4055
|
`);
|
|
4056
4056
|
const u = (m = 1) => " ".repeat(m), f = this.#r.flags.filter(
|
|
@@ -4073,7 +4073,7 @@ Arguments Remaining After Simulation:`)
|
|
|
4073
4073
|
if (!(p instanceof G))
|
|
4074
4074
|
return `${u()}${t(m.padEnd(20))} [Error: Subcommand '${m}' has an invalid parser configuration]`;
|
|
4075
4075
|
let $ = `${u()}${t(m)}`;
|
|
4076
|
-
const g = p.#
|
|
4076
|
+
const g = p.#l;
|
|
4077
4077
|
g && ($ += `
|
|
4078
4078
|
${u(2)}${r(g)}`);
|
|
4079
4079
|
const v = ((p && p.#r ? p.#r.flags : void 0) || []).filter(
|
|
@@ -4227,7 +4227,7 @@ ${y.dim(`Try '${t} --help' for usage details.`)}`
|
|
|
4227
4227
|
const n = " ".repeat(t), o = " ".repeat(t + 1), s = " ".repeat(t + 2);
|
|
4228
4228
|
this.#e.info(
|
|
4229
4229
|
`${n}Parser: ${y.blueBright(e.#n || e.#t)}`
|
|
4230
|
-
), e.#
|
|
4230
|
+
), e.#l && this.#e.info(`${o}Description: ${e.#l}`), this.#e.info(`${o}Options:`), this.#e.info(`${s}appName: ${e.#t}`), this.#e.info(
|
|
4231
4231
|
`${s}appCommandName: ${e.#o ?? y.dim("undefined")}`
|
|
4232
4232
|
), this.#e.info(`${s}handleErrors: ${e.#p}`), this.#e.info(
|
|
4233
4233
|
`${s}throwForDuplicateFlags: ${e.#b}`
|
|
@@ -4275,7 +4275,7 @@ ${y.dim(`Try '${t} --help' for usage details.`)}`
|
|
|
4275
4275
|
l(
|
|
4276
4276
|
`${o}Parser: ${e.#n || e.#t}`
|
|
4277
4277
|
// #appName is guaranteed
|
|
4278
|
-
), e.#
|
|
4278
|
+
), e.#l && l(`${s}Description: ${e.#l}`), l(`${s}Options:`), l(`${a}appName: ${e.#t}`), l(
|
|
4279
4279
|
`${a}appCommandName: ${e.#o ?? "undefined"}`
|
|
4280
4280
|
), l(`${a}handleErrors: ${e.#p}`), l(
|
|
4281
4281
|
`${a}throwForDuplicateFlags: ${e.#b}`
|
|
@@ -4326,7 +4326,7 @@ ${y.dim(`Try '${t} --help' for usage details.`)}`
|
|
|
4326
4326
|
const r = {
|
|
4327
4327
|
parserName: e.#n || e.#t,
|
|
4328
4328
|
// #appName is guaranteed
|
|
4329
|
-
description: e.#
|
|
4329
|
+
description: e.#l,
|
|
4330
4330
|
options: {
|
|
4331
4331
|
appName: e.#t,
|
|
4332
4332
|
appCommandName: e.#o ?? void 0,
|