@zinn-dev/cli 0.11.0 → 0.12.0
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/package.json +1 -1
- package/src/constant.ts +1 -0
- package/src/routes/task-router.ts +17 -1
package/package.json
CHANGED
package/src/constant.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TASK_DESCRIPTION_PREVIEW_LENGTH = 80;
|
|
@@ -5,6 +5,21 @@ import { task, project, column } from "@zinn-dev/core";
|
|
|
5
5
|
|
|
6
6
|
import { quit, validatePositionalCount, validateUniqueOptions } from "../lib";
|
|
7
7
|
import { formatRelations, relationRouter } from "./relation-router";
|
|
8
|
+
import { TASK_DESCRIPTION_PREVIEW_LENGTH } from "../constant";
|
|
9
|
+
|
|
10
|
+
function formatTaskDescriptionPreview(description: string | null) {
|
|
11
|
+
if (description == null) {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const normalizedDescription = description.replace(/\s+/g, " ").trim();
|
|
16
|
+
|
|
17
|
+
if (normalizedDescription.length <= TASK_DESCRIPTION_PREVIEW_LENGTH) {
|
|
18
|
+
return normalizedDescription;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return `${normalizedDescription.slice(0, TASK_DESCRIPTION_PREVIEW_LENGTH - 1).trimEnd()}…`;
|
|
22
|
+
}
|
|
8
23
|
|
|
9
24
|
// TODO: a CLI row formatter that accepts text columns and joins them with " | " would be useful
|
|
10
25
|
// Reuse it across task list/view and other command output in a separate change.
|
|
@@ -196,7 +211,8 @@ Example: zinn task create MDR --title "Refine the numbers" --description "Meet t
|
|
|
196
211
|
.map((t) => {
|
|
197
212
|
// TODO: console output formatting for standardizied output
|
|
198
213
|
const status = showsAll ? ` | ${t.status.padEnd(longestStatusLength)}` : "";
|
|
199
|
-
const
|
|
214
|
+
const descriptionPreview = formatTaskDescriptionPreview(t.description);
|
|
215
|
+
const description = t.description == null ? "" : ` | ${descriptionPreview}`;
|
|
200
216
|
const priority = t.priority == null ? "" : ` | Priority: ${t.priority}`;
|
|
201
217
|
return `${t.id.padEnd(longestIdLength)}${status} | ${t.column} | ${t.title}${description}${priority}`;
|
|
202
218
|
})
|