@zinn-dev/cli 0.22.0 → 0.24.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/README.md +25 -0
- package/index.ts +2 -0
- package/package.json +2 -2
- package/src/routes/project-router.ts +110 -4
package/README.md
CHANGED
|
@@ -50,6 +50,31 @@ Add another column at the end of the board:
|
|
|
50
50
|
zinn project column create MDR "Boardlog"
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
Rename a column:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
zinn project column edit MDR "In Progress" --name "Refining"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Columns are matched by name, and matching is case-insenstivie. Names are trimmed and they cannot be blank.
|
|
60
|
+
Since columns are case-insensitive, you cannot have two columns with only different casing such as `todo` and `Todo`. However, you are free to change the casing of an existing column.
|
|
61
|
+
Tasks stay in the renamed column.
|
|
62
|
+
|
|
63
|
+
Change a column's position on the board:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
zinn project column order MDR Review first
|
|
67
|
+
zinn project column order MDR Review previous
|
|
68
|
+
zinn project column order MDR Review next
|
|
69
|
+
zinn project column order MDR Review last
|
|
70
|
+
zinn project column order MDR Review before "In Progress"
|
|
71
|
+
zinn project column order MDR Review after Done
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Directions follow board order: `first` is the start of the board and `last` is its end.
|
|
75
|
+
Both the column and the target of `before` or `after` are matched by name, and matching is case-insensitive.
|
|
76
|
+
Moving a column to the position it already has, or before or after itself, does nothing. Tasks stay in their columns.
|
|
77
|
+
|
|
53
78
|
`zinn project delete MDR` asks for confirmation, then permanently deletes the project and all of its columns and tasks.
|
|
54
79
|
|
|
55
80
|
## Create and read tasks
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "A kanban workflow in the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": {
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@zinn-dev/core": "0.
|
|
45
|
+
"@zinn-dev/core": "0.17.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -24,6 +24,18 @@ function formatProject(presented: PresentedProject) {
|
|
|
24
24
|
return `${presented.key} | ${presented.name}`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
type PresentedColumn = { project: string; name: string };
|
|
28
|
+
|
|
29
|
+
function presentColumn(columnMatch: { project_id: string; name: string }): PresentedColumn {
|
|
30
|
+
const columnProject = project.getById(columnMatch.project_id)!;
|
|
31
|
+
|
|
32
|
+
return { project: columnProject.key, name: columnMatch.name };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function formatColumn(presented: PresentedColumn) {
|
|
36
|
+
return `${presented.project} | ${presented.name}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
export const projectRouter = {
|
|
28
40
|
edit: {
|
|
29
41
|
run: (args) => {
|
|
@@ -201,10 +213,7 @@ Example: zinn project delete MDR`,
|
|
|
201
213
|
|
|
202
214
|
try {
|
|
203
215
|
const createdColumn = column.create({ projectKey, name: columnName });
|
|
204
|
-
|
|
205
|
-
const presentedColumn = { project: columnProject.key, name: createdColumn.name };
|
|
206
|
-
|
|
207
|
-
output(presentedColumn, (c) => `${c.project} | ${c.name}`);
|
|
216
|
+
output(presentColumn(createdColumn), formatColumn);
|
|
208
217
|
} catch (err: any) {
|
|
209
218
|
quit(err?.message ?? "Something went wrong");
|
|
210
219
|
}
|
|
@@ -212,8 +221,105 @@ Example: zinn project delete MDR`,
|
|
|
212
221
|
help: `Usage: zinn project column create <project-key> <column-name>
|
|
213
222
|
|
|
214
223
|
Add a column at the end of a project's board.
|
|
224
|
+
Names are trimmed, must contain printable text on a single line, and must be unique within the project regardless of casing.
|
|
215
225
|
|
|
216
226
|
Example: zinn project column create MDR "Boardlog"`,
|
|
227
|
+
},
|
|
228
|
+
edit: {
|
|
229
|
+
run: (args: Array<string>) => {
|
|
230
|
+
const { values, positionals, tokens } = parseArgs({
|
|
231
|
+
args,
|
|
232
|
+
options: { name: { type: "string" } },
|
|
233
|
+
allowPositionals: true,
|
|
234
|
+
strict: true,
|
|
235
|
+
tokens: true,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
validatePositionalCount(
|
|
239
|
+
positionals,
|
|
240
|
+
2,
|
|
241
|
+
"Both the project key and the column name must be specified",
|
|
242
|
+
);
|
|
243
|
+
validateUniqueOptions(tokens);
|
|
244
|
+
|
|
245
|
+
if (values.name === undefined) {
|
|
246
|
+
quit("Provide an edit flag: --name");
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const editedColumn = column.edit({
|
|
250
|
+
projectKey: positionals[0]!,
|
|
251
|
+
columnName: positionals[1]!,
|
|
252
|
+
name: values.name,
|
|
253
|
+
});
|
|
254
|
+
output(presentColumn(editedColumn), formatColumn);
|
|
255
|
+
},
|
|
256
|
+
help: `Usage: zinn project column edit <project-key> <column-name> --name <text>
|
|
257
|
+
|
|
258
|
+
Rename a column.
|
|
259
|
+
The --name flag is required.
|
|
260
|
+
|
|
261
|
+
Columns are matched by name, and matching is case-insensitive.
|
|
262
|
+
Names are trimmed, and must remain unique within the same project.
|
|
263
|
+
Changing only the casing of a column's own name is allowed.
|
|
264
|
+
|
|
265
|
+
Example: zinn project column edit MDR "In Progress" --name "Refining"`,
|
|
266
|
+
},
|
|
267
|
+
order: {
|
|
268
|
+
run: (args: Array<string>) => {
|
|
269
|
+
const [projectKey, columnName, direction, targetColumnName, ...extraArgs] = args;
|
|
270
|
+
|
|
271
|
+
if (projectKey == null || columnName == null) {
|
|
272
|
+
quit("Both the project key and the column name must be specified");
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (direction == null) {
|
|
276
|
+
quit("Order direction must be specified");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
let orderedColumn: ReturnType<typeof column.order>;
|
|
280
|
+
|
|
281
|
+
switch (direction) {
|
|
282
|
+
case "before":
|
|
283
|
+
case "after": {
|
|
284
|
+
if (targetColumnName == null) {
|
|
285
|
+
quit(`Target column must be specified for "${direction}"`);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (extraArgs.length > 0) {
|
|
289
|
+
quit("Only one target column can be specified");
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
orderedColumn = column.order({ projectKey, columnName, direction, targetColumnName });
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
case "first":
|
|
296
|
+
case "previous":
|
|
297
|
+
case "next":
|
|
298
|
+
case "last": {
|
|
299
|
+
if (targetColumnName != null) {
|
|
300
|
+
quit(`Order direction "${direction}" does not accept a target column`);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
orderedColumn = column.order({ projectKey, columnName, direction });
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
default:
|
|
307
|
+
quit(`Unknown order direction "${direction}"`);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// TODO: maybe also print the new full column state?
|
|
311
|
+
output(presentColumn(orderedColumn), formatColumn);
|
|
312
|
+
},
|
|
313
|
+
help: `Usage: zinn project column order <project-key> <column-name> <first | previous | next | last>
|
|
314
|
+
zinn project column order <project-key> <column-name> <before | after> <target-column-name>
|
|
315
|
+
|
|
316
|
+
Change a column's position on the project's board.
|
|
317
|
+
Use first or last for either end, previous or next for one position,
|
|
318
|
+
or before or after to place it relative to another column.
|
|
319
|
+
|
|
320
|
+
Columns are matched by name, and matching is case-insensitive.
|
|
321
|
+
|
|
322
|
+
Example: zinn project column order MDR Review before "In Progress"`,
|
|
217
323
|
},
|
|
218
324
|
list: {
|
|
219
325
|
run: (args: Array<string>) => {
|