@optique/core 0.7.16 → 0.7.17-dev.396

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.
@@ -1133,9 +1133,14 @@ function group(label, parser) {
1133
1133
  kind: "available",
1134
1134
  state: parser.initialState
1135
1135
  }, void 0);
1136
- const initialHasCommands = initialFragments.fragments.some((f) => f.type === "entry" && f.term.type === "command" || f.type === "section" && f.entries.some((e) => e.term.type === "command"));
1137
- const currentHasCommands = allEntries.some((e) => e.term.type === "command");
1138
- const applyLabel = !initialHasCommands || currentHasCommands;
1136
+ const initialCommandNames = /* @__PURE__ */ new Set();
1137
+ for (const f of initialFragments.fragments) if (f.type === "entry" && f.term.type === "command") initialCommandNames.add(f.term.name);
1138
+ else if (f.type === "section") {
1139
+ for (const e of f.entries) if (e.term.type === "command") initialCommandNames.add(e.term.name);
1140
+ }
1141
+ const initialHasCommands = initialCommandNames.size > 0;
1142
+ const currentCommandsAreGroupOwn = allEntries.some((e) => e.term.type === "command" && initialCommandNames.has(e.term.name));
1143
+ const applyLabel = !initialHasCommands || currentCommandsAreGroupOwn;
1139
1144
  const labeledSection = applyLabel ? {
1140
1145
  title: label,
1141
1146
  entries: allEntries
@@ -1133,9 +1133,14 @@ function group(label, parser) {
1133
1133
  kind: "available",
1134
1134
  state: parser.initialState
1135
1135
  }, void 0);
1136
- const initialHasCommands = initialFragments.fragments.some((f) => f.type === "entry" && f.term.type === "command" || f.type === "section" && f.entries.some((e) => e.term.type === "command"));
1137
- const currentHasCommands = allEntries.some((e) => e.term.type === "command");
1138
- const applyLabel = !initialHasCommands || currentHasCommands;
1136
+ const initialCommandNames = /* @__PURE__ */ new Set();
1137
+ for (const f of initialFragments.fragments) if (f.type === "entry" && f.term.type === "command") initialCommandNames.add(f.term.name);
1138
+ else if (f.type === "section") {
1139
+ for (const e of f.entries) if (e.term.type === "command") initialCommandNames.add(e.term.name);
1140
+ }
1141
+ const initialHasCommands = initialCommandNames.size > 0;
1142
+ const currentCommandsAreGroupOwn = allEntries.some((e) => e.term.type === "command" && initialCommandNames.has(e.term.name));
1143
+ const applyLabel = !initialHasCommands || currentCommandsAreGroupOwn;
1139
1144
  const labeledSection = applyLabel ? {
1140
1145
  title: label,
1141
1146
  entries: allEntries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.7.16",
3
+ "version": "0.7.17-dev.396+609a7342",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",