@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.
@@ -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 (options.hidden) return {
969
- fragments: [],
970
- description: options.description
971
- };
972
- if (state.kind === "unavailable" || typeof state.state === "undefined") return {
973
- description: options.description,
974
- fragments: [{
975
- type: "entry",
976
- term: {
977
- type: "command",
978
- name
979
- },
980
- description: options.brief ?? options.description
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]
@@ -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 (options.hidden) return {
969
- fragments: [],
970
- description: options.description
971
- };
972
- if (state.kind === "unavailable" || typeof state.state === "undefined") return {
973
- description: options.description,
974
- fragments: [{
975
- type: "entry",
976
- term: {
977
- type: "command",
978
- name
979
- },
980
- description: options.brief ?? options.description
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.10.0-dev.333+076fceae",
3
+ "version": "0.10.0-dev.335+bfcb880a",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",