@optique/core 0.10.0-dev.333 → 0.10.0-dev.335
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
|
@@ -965,21 +965,23 @@ function command(name, parser, options = {}) {
|
|
|
965
965
|
return suggestCommandSync(context, prefix, name, parser, options);
|
|
966
966
|
},
|
|
967
967
|
getDocFragments(state, defaultValue) {
|
|
968
|
-
if (
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
968
|
+
if (state.kind === "unavailable" || typeof state.state === "undefined") {
|
|
969
|
+
if (options.hidden) return {
|
|
970
|
+
fragments: [],
|
|
971
|
+
description: options.description
|
|
972
|
+
};
|
|
973
|
+
return {
|
|
974
|
+
description: options.description,
|
|
975
|
+
fragments: [{
|
|
976
|
+
type: "entry",
|
|
977
|
+
term: {
|
|
978
|
+
type: "command",
|
|
979
|
+
name
|
|
980
|
+
},
|
|
981
|
+
description: options.brief ?? options.description
|
|
982
|
+
}]
|
|
983
|
+
};
|
|
984
|
+
}
|
|
983
985
|
const innerState = state.state[0] === "parsing" ? {
|
|
984
986
|
kind: "available",
|
|
985
987
|
state: state.state[1]
|
package/dist/primitives.js
CHANGED
|
@@ -965,21 +965,23 @@ function command(name, parser, options = {}) {
|
|
|
965
965
|
return suggestCommandSync(context, prefix, name, parser, options);
|
|
966
966
|
},
|
|
967
967
|
getDocFragments(state, defaultValue) {
|
|
968
|
-
if (
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
968
|
+
if (state.kind === "unavailable" || typeof state.state === "undefined") {
|
|
969
|
+
if (options.hidden) return {
|
|
970
|
+
fragments: [],
|
|
971
|
+
description: options.description
|
|
972
|
+
};
|
|
973
|
+
return {
|
|
974
|
+
description: options.description,
|
|
975
|
+
fragments: [{
|
|
976
|
+
type: "entry",
|
|
977
|
+
term: {
|
|
978
|
+
type: "command",
|
|
979
|
+
name
|
|
980
|
+
},
|
|
981
|
+
description: options.brief ?? options.description
|
|
982
|
+
}]
|
|
983
|
+
};
|
|
984
|
+
}
|
|
983
985
|
const innerState = state.state[0] === "parsing" ? {
|
|
984
986
|
kind: "available",
|
|
985
987
|
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
|
}
|