@optique/core 0.9.1 → 0.9.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/dist/primitives.cjs +17 -15
- package/dist/primitives.js +17 -15
- package/dist/usage.cjs +2 -0
- package/dist/usage.js +2 -0
- package/package.json +1 -1
package/dist/primitives.cjs
CHANGED
|
@@ -840,21 +840,23 @@ function command(name, parser, options = {}) {
|
|
|
840
840
|
return suggestCommandSync(context, prefix, name, parser, options);
|
|
841
841
|
},
|
|
842
842
|
getDocFragments(state, defaultValue) {
|
|
843
|
-
if (
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
843
|
+
if (state.kind === "unavailable" || typeof state.state === "undefined") {
|
|
844
|
+
if (options.hidden) return {
|
|
845
|
+
fragments: [],
|
|
846
|
+
description: options.description
|
|
847
|
+
};
|
|
848
|
+
return {
|
|
849
|
+
description: options.description,
|
|
850
|
+
fragments: [{
|
|
851
|
+
type: "entry",
|
|
852
|
+
term: {
|
|
853
|
+
type: "command",
|
|
854
|
+
name
|
|
855
|
+
},
|
|
856
|
+
description: options.brief ?? options.description
|
|
857
|
+
}]
|
|
858
|
+
};
|
|
859
|
+
}
|
|
858
860
|
const innerState = state.state[0] === "parsing" ? {
|
|
859
861
|
kind: "available",
|
|
860
862
|
state: state.state[1]
|
package/dist/primitives.js
CHANGED
|
@@ -840,21 +840,23 @@ function command(name, parser, options = {}) {
|
|
|
840
840
|
return suggestCommandSync(context, prefix, name, parser, options);
|
|
841
841
|
},
|
|
842
842
|
getDocFragments(state, defaultValue) {
|
|
843
|
-
if (
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
843
|
+
if (state.kind === "unavailable" || typeof state.state === "undefined") {
|
|
844
|
+
if (options.hidden) return {
|
|
845
|
+
fragments: [],
|
|
846
|
+
description: options.description
|
|
847
|
+
};
|
|
848
|
+
return {
|
|
849
|
+
description: options.description,
|
|
850
|
+
fragments: [{
|
|
851
|
+
type: "entry",
|
|
852
|
+
term: {
|
|
853
|
+
type: "command",
|
|
854
|
+
name
|
|
855
|
+
},
|
|
856
|
+
description: options.brief ?? options.description
|
|
857
|
+
}]
|
|
858
|
+
};
|
|
859
|
+
}
|
|
858
860
|
const innerState = state.state[0] === "parsing" ? {
|
|
859
861
|
kind: "available",
|
|
860
862
|
state: state.state[1]
|
package/dist/usage.cjs
CHANGED
|
@@ -123,6 +123,8 @@ function formatUsage(programName, usage, options = {}) {
|
|
|
123
123
|
if (usage.length > 0 && usage.slice(0, -1).every((t) => t.type === "command") && lastTerm.type === "exclusive" && lastTerm.terms.every((t) => t.length > 0 && (t[0].type === "command" || t[0].type === "option" || t[0].type === "argument" || t[0].type === "optional" && t[0].terms.length === 1 && (t[0].terms[0].type === "command" || t[0].terms[0].type === "option" || t[0].terms[0].type === "argument")))) {
|
|
124
124
|
const lines = [];
|
|
125
125
|
for (let command of lastTerm.terms) {
|
|
126
|
+
const firstTerm = command[0];
|
|
127
|
+
if (firstTerm?.type === "command" && firstTerm.hidden) continue;
|
|
126
128
|
if (usage.length > 1) command = [...usage.slice(0, -1), ...command];
|
|
127
129
|
lines.push(formatUsage(programName, command, options));
|
|
128
130
|
}
|
package/dist/usage.js
CHANGED
|
@@ -122,6 +122,8 @@ function formatUsage(programName, usage, options = {}) {
|
|
|
122
122
|
if (usage.length > 0 && usage.slice(0, -1).every((t) => t.type === "command") && lastTerm.type === "exclusive" && lastTerm.terms.every((t) => t.length > 0 && (t[0].type === "command" || t[0].type === "option" || t[0].type === "argument" || t[0].type === "optional" && t[0].terms.length === 1 && (t[0].terms[0].type === "command" || t[0].terms[0].type === "option" || t[0].terms[0].type === "argument")))) {
|
|
123
123
|
const lines = [];
|
|
124
124
|
for (let command of lastTerm.terms) {
|
|
125
|
+
const firstTerm = command[0];
|
|
126
|
+
if (firstTerm?.type === "command" && firstTerm.hidden) continue;
|
|
125
127
|
if (usage.length > 1) command = [...usage.slice(0, -1), ...command];
|
|
126
128
|
lines.push(formatUsage(programName, command, options));
|
|
127
129
|
}
|