azdo-cli 0.6.0 → 0.7.0-develop.164
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/index.js +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -785,18 +785,32 @@ function convertRichText(html, markdown) {
|
|
|
785
785
|
if (!html) return "";
|
|
786
786
|
return markdown ? toMarkdown(html) : stripHtml(html);
|
|
787
787
|
}
|
|
788
|
+
function formatMarkdownField(fieldLabel, value) {
|
|
789
|
+
if (value.includes("\n")) {
|
|
790
|
+
return `${fieldLabel}:
|
|
791
|
+
${value}`;
|
|
792
|
+
}
|
|
793
|
+
return `${fieldLabel}: ${value}`;
|
|
794
|
+
}
|
|
788
795
|
function formatExtraFields(extraFields, markdown) {
|
|
789
796
|
return Object.entries(extraFields).map(([refName, value]) => {
|
|
790
797
|
const fieldLabel = refName.includes(".") ? refName.split(".").pop() : refName;
|
|
791
|
-
|
|
792
|
-
|
|
798
|
+
if (markdown) {
|
|
799
|
+
const displayValue = toMarkdown(value);
|
|
800
|
+
return formatMarkdownField(fieldLabel, displayValue);
|
|
801
|
+
}
|
|
802
|
+
return `${fieldLabel.padEnd(13)}${value}`;
|
|
793
803
|
});
|
|
794
804
|
}
|
|
795
|
-
function summarizeDescription(text, label) {
|
|
805
|
+
function summarizeDescription(text, label, markdown) {
|
|
796
806
|
const descLines = text.split("\n").filter((l) => l.trim() !== "");
|
|
797
807
|
const firstThree = descLines.slice(0, 3);
|
|
798
808
|
const suffix = descLines.length > 3 ? "\n..." : "";
|
|
799
|
-
|
|
809
|
+
const content = `${firstThree.join("\n")}${suffix}`;
|
|
810
|
+
if (markdown) {
|
|
811
|
+
return [formatMarkdownField("Description", content)];
|
|
812
|
+
}
|
|
813
|
+
return [`${label("Description:")}${content}`];
|
|
800
814
|
}
|
|
801
815
|
function formatWorkItem(workItem, short, markdown = false) {
|
|
802
816
|
const label = (name) => name.padEnd(13);
|
|
@@ -820,7 +834,7 @@ function formatWorkItem(workItem, short, markdown = false) {
|
|
|
820
834
|
lines.push("");
|
|
821
835
|
const descriptionText = convertRichText(workItem.description, markdown);
|
|
822
836
|
if (short) {
|
|
823
|
-
lines.push(...summarizeDescription(descriptionText, label));
|
|
837
|
+
lines.push(...summarizeDescription(descriptionText, label, markdown));
|
|
824
838
|
} else {
|
|
825
839
|
lines.push("Description:", descriptionText);
|
|
826
840
|
}
|