@krodak/clickup-cli 0.12.1 → 0.12.2
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 +31 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -248,6 +248,15 @@ var ClickUpClient = class {
|
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
|
|
251
|
+
// src/date.ts
|
|
252
|
+
function formatDate(ms) {
|
|
253
|
+
const d = new Date(Number(ms));
|
|
254
|
+
const year = d.getUTCFullYear();
|
|
255
|
+
const month = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
256
|
+
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
257
|
+
return `${year}-${month}-${day}`;
|
|
258
|
+
}
|
|
259
|
+
|
|
251
260
|
// src/output.ts
|
|
252
261
|
import chalk from "chalk";
|
|
253
262
|
function isTTY() {
|
|
@@ -348,13 +357,6 @@ ${formatMarkdownTable(g.tasks, TASK_MD_COLUMNS)}`);
|
|
|
348
357
|
if (sections.length === 0) return "No tasks found.";
|
|
349
358
|
return sections.join("\n\n");
|
|
350
359
|
}
|
|
351
|
-
function formatDate(ms) {
|
|
352
|
-
const d = new Date(Number(ms));
|
|
353
|
-
const year = d.getUTCFullYear();
|
|
354
|
-
const month = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
355
|
-
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
356
|
-
return `${year}-${month}-${day}`;
|
|
357
|
-
}
|
|
358
360
|
function formatDuration(ms) {
|
|
359
361
|
const totalMinutes = Math.floor(ms / 6e4);
|
|
360
362
|
const hours = Math.floor(totalMinutes / 60);
|
|
@@ -627,11 +629,7 @@ function isInitiative(task) {
|
|
|
627
629
|
}
|
|
628
630
|
function formatDueDate(ms) {
|
|
629
631
|
if (!ms) return "";
|
|
630
|
-
|
|
631
|
-
const year = d.getUTCFullYear();
|
|
632
|
-
const month = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
633
|
-
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
634
|
-
return `${year}-${month}-${day}`;
|
|
632
|
+
return formatDate(ms);
|
|
635
633
|
}
|
|
636
634
|
function summarize(task) {
|
|
637
635
|
return {
|
|
@@ -2098,8 +2096,19 @@ async function moveTask(config, taskId, opts) {
|
|
|
2098
2096
|
messages.push(`Added ${taskId} to list ${opts.to}`);
|
|
2099
2097
|
}
|
|
2100
2098
|
if (opts.remove) {
|
|
2101
|
-
|
|
2102
|
-
|
|
2099
|
+
try {
|
|
2100
|
+
await client.removeTaskFromList(taskId, opts.remove);
|
|
2101
|
+
messages.push(`Removed ${taskId} from list ${opts.remove}`);
|
|
2102
|
+
} catch (err) {
|
|
2103
|
+
if (messages.length > 0) {
|
|
2104
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
2105
|
+
throw new Error(
|
|
2106
|
+
`${messages.join("; ")}; but failed to remove from list ${opts.remove}: ${reason}`,
|
|
2107
|
+
{ cause: err }
|
|
2108
|
+
);
|
|
2109
|
+
}
|
|
2110
|
+
throw err;
|
|
2111
|
+
}
|
|
2103
2112
|
}
|
|
2104
2113
|
return messages.join("; ");
|
|
2105
2114
|
}
|
|
@@ -2336,7 +2345,13 @@ program.command("depend <taskId>").description("Add or remove task dependencies"
|
|
|
2336
2345
|
const config = loadConfig();
|
|
2337
2346
|
const message = await manageDependency(config, taskId, opts);
|
|
2338
2347
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
2339
|
-
console.log(
|
|
2348
|
+
console.log(
|
|
2349
|
+
JSON.stringify(
|
|
2350
|
+
{ taskId, on: opts.on, blocks: opts.blocks, remove: opts.remove, message },
|
|
2351
|
+
null,
|
|
2352
|
+
2
|
|
2353
|
+
)
|
|
2354
|
+
);
|
|
2340
2355
|
} else {
|
|
2341
2356
|
console.log(message);
|
|
2342
2357
|
}
|
|
@@ -2347,7 +2362,7 @@ program.command("move <taskId>").description("Add or remove a task from a list")
|
|
|
2347
2362
|
const config = loadConfig();
|
|
2348
2363
|
const message = await moveTask(config, taskId, opts);
|
|
2349
2364
|
if (shouldOutputJson(opts.json ?? false)) {
|
|
2350
|
-
console.log(JSON.stringify({ taskId,
|
|
2365
|
+
console.log(JSON.stringify({ taskId, to: opts.to, remove: opts.remove, message }, null, 2));
|
|
2351
2366
|
} else {
|
|
2352
2367
|
console.log(message);
|
|
2353
2368
|
}
|