@harborppm/cli 0.20.0 → 0.20.1
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/lib/cli.mjs +4 -2
- package/lib/format.mjs +10 -6
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -1137,7 +1137,9 @@ export async function run(argv, io = {}) {
|
|
|
1137
1137
|
const [project, column, value, ...extra] = positionals;
|
|
1138
1138
|
if (!project) throw new HarborError("Give a project, like harbor limit RR doing 5.");
|
|
1139
1139
|
if (!column) {
|
|
1140
|
-
return call("get_project", { harbor, project }, (r) =>
|
|
1140
|
+
return call("get_project", { harbor, project }, (r) =>
|
|
1141
|
+
limitsText(r.name, r.limits, r.tasks),
|
|
1142
|
+
);
|
|
1141
1143
|
}
|
|
1142
1144
|
if (value === undefined || extra.length) {
|
|
1143
1145
|
throw new HarborError(`Give one limit for ${column}: a number like 5, or none.`);
|
|
@@ -1147,7 +1149,7 @@ export async function run(argv, io = {}) {
|
|
|
1147
1149
|
throw new HarborError("A limit is a whole number from 1 to 20, or none.");
|
|
1148
1150
|
}
|
|
1149
1151
|
return call("set_column_limit", { harbor, project, column, limit }, (r) =>
|
|
1150
|
-
limitsText(r.set.project, r.limits),
|
|
1152
|
+
limitsText(r.set.project, r.limits, r.tasks),
|
|
1151
1153
|
);
|
|
1152
1154
|
}
|
|
1153
1155
|
case "voyage": {
|
package/lib/format.mjs
CHANGED
|
@@ -144,12 +144,16 @@ export function projectList(r, { done = false } = {}) {
|
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
/** A project's column limits: "doing 5
|
|
148
|
-
export function limitsText(name, limits) {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
/** A project's column limits with how full each is: "doing 4 of 5; no limit on backlog, todo, done". */
|
|
148
|
+
export function limitsText(name, limits, tasks = {}) {
|
|
149
|
+
const entries = Object.entries(limits ?? {});
|
|
150
|
+
const capped = entries
|
|
151
|
+
.filter(([, n]) => n != null)
|
|
152
|
+
.map(([status, n]) => `${STATUS[status] ?? status} ${tasks[status] ?? 0} of ${n}`);
|
|
153
|
+
const open = entries.filter(([, n]) => n == null).map(([status]) => STATUS[status] ?? status);
|
|
154
|
+
if (!capped.length) return `${name}'s board has no column limits.`;
|
|
155
|
+
const rest = open.length ? `; no limit on ${open.join(", ")}` : "";
|
|
156
|
+
return `${name}: ${capped.join(", ")}${rest}.`;
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
export function harbors(r) {
|