@optique/core 0.7.16-dev.389 → 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.
- package/dist/constructs.cjs +36 -14
- package/dist/constructs.js +36 -14
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -882,6 +882,9 @@ function merge(...args) {
|
|
|
882
882
|
});
|
|
883
883
|
},
|
|
884
884
|
getDocFragments(state, _defaultValue) {
|
|
885
|
+
let brief;
|
|
886
|
+
let description;
|
|
887
|
+
let footer;
|
|
885
888
|
const fragments = parsers.flatMap((p, i) => {
|
|
886
889
|
let parserState;
|
|
887
890
|
if (p.initialState === void 0) {
|
|
@@ -895,7 +898,11 @@ function merge(...args) {
|
|
|
895
898
|
kind: "available",
|
|
896
899
|
state: state.state
|
|
897
900
|
};
|
|
898
|
-
|
|
901
|
+
const docFragments = p.getDocFragments(parserState, void 0);
|
|
902
|
+
brief ??= docFragments.brief;
|
|
903
|
+
description ??= docFragments.description;
|
|
904
|
+
footer ??= docFragments.footer;
|
|
905
|
+
return docFragments.fragments;
|
|
899
906
|
});
|
|
900
907
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
901
908
|
const sections = [];
|
|
@@ -910,18 +917,28 @@ function merge(...args) {
|
|
|
910
917
|
entries
|
|
911
918
|
};
|
|
912
919
|
sections.push(labeledSection);
|
|
913
|
-
return {
|
|
920
|
+
return {
|
|
921
|
+
brief,
|
|
922
|
+
description,
|
|
923
|
+
footer,
|
|
924
|
+
fragments: sections.map((s) => ({
|
|
925
|
+
...s,
|
|
926
|
+
type: "section"
|
|
927
|
+
}))
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
brief,
|
|
932
|
+
description,
|
|
933
|
+
footer,
|
|
934
|
+
fragments: [...sections.map((s) => ({
|
|
914
935
|
...s,
|
|
915
936
|
type: "section"
|
|
916
|
-
}))
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
})), {
|
|
922
|
-
type: "section",
|
|
923
|
-
entries
|
|
924
|
-
}] };
|
|
937
|
+
})), {
|
|
938
|
+
type: "section",
|
|
939
|
+
entries
|
|
940
|
+
}]
|
|
941
|
+
};
|
|
925
942
|
}
|
|
926
943
|
};
|
|
927
944
|
}
|
|
@@ -1116,9 +1133,14 @@ function group(label, parser) {
|
|
|
1116
1133
|
kind: "available",
|
|
1117
1134
|
state: parser.initialState
|
|
1118
1135
|
}, void 0);
|
|
1119
|
-
const
|
|
1120
|
-
const
|
|
1121
|
-
|
|
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;
|
|
1122
1144
|
const labeledSection = applyLabel ? {
|
|
1123
1145
|
title: label,
|
|
1124
1146
|
entries: allEntries
|
package/dist/constructs.js
CHANGED
|
@@ -882,6 +882,9 @@ function merge(...args) {
|
|
|
882
882
|
});
|
|
883
883
|
},
|
|
884
884
|
getDocFragments(state, _defaultValue) {
|
|
885
|
+
let brief;
|
|
886
|
+
let description;
|
|
887
|
+
let footer;
|
|
885
888
|
const fragments = parsers.flatMap((p, i) => {
|
|
886
889
|
let parserState;
|
|
887
890
|
if (p.initialState === void 0) {
|
|
@@ -895,7 +898,11 @@ function merge(...args) {
|
|
|
895
898
|
kind: "available",
|
|
896
899
|
state: state.state
|
|
897
900
|
};
|
|
898
|
-
|
|
901
|
+
const docFragments = p.getDocFragments(parserState, void 0);
|
|
902
|
+
brief ??= docFragments.brief;
|
|
903
|
+
description ??= docFragments.description;
|
|
904
|
+
footer ??= docFragments.footer;
|
|
905
|
+
return docFragments.fragments;
|
|
899
906
|
});
|
|
900
907
|
const entries = fragments.filter((f) => f.type === "entry");
|
|
901
908
|
const sections = [];
|
|
@@ -910,18 +917,28 @@ function merge(...args) {
|
|
|
910
917
|
entries
|
|
911
918
|
};
|
|
912
919
|
sections.push(labeledSection);
|
|
913
|
-
return {
|
|
920
|
+
return {
|
|
921
|
+
brief,
|
|
922
|
+
description,
|
|
923
|
+
footer,
|
|
924
|
+
fragments: sections.map((s) => ({
|
|
925
|
+
...s,
|
|
926
|
+
type: "section"
|
|
927
|
+
}))
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
return {
|
|
931
|
+
brief,
|
|
932
|
+
description,
|
|
933
|
+
footer,
|
|
934
|
+
fragments: [...sections.map((s) => ({
|
|
914
935
|
...s,
|
|
915
936
|
type: "section"
|
|
916
|
-
}))
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
})), {
|
|
922
|
-
type: "section",
|
|
923
|
-
entries
|
|
924
|
-
}] };
|
|
937
|
+
})), {
|
|
938
|
+
type: "section",
|
|
939
|
+
entries
|
|
940
|
+
}]
|
|
941
|
+
};
|
|
925
942
|
}
|
|
926
943
|
};
|
|
927
944
|
}
|
|
@@ -1116,9 +1133,14 @@ function group(label, parser) {
|
|
|
1116
1133
|
kind: "available",
|
|
1117
1134
|
state: parser.initialState
|
|
1118
1135
|
}, void 0);
|
|
1119
|
-
const
|
|
1120
|
-
const
|
|
1121
|
-
|
|
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;
|
|
1122
1144
|
const labeledSection = applyLabel ? {
|
|
1123
1145
|
title: label,
|
|
1124
1146
|
entries: allEntries
|