@zinn-dev/cli 0.2.0 → 0.3.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 +10 -0
- package/package.json +2 -2
- package/src/routes/project-router.ts +52 -0
package/README.md
CHANGED
|
@@ -26,6 +26,16 @@ zinn project list
|
|
|
26
26
|
zinn project column list SITE
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
Rename a project:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
zinn project edit SITE --name "Website redesign"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The `--name` flag is required. Names must contain printable text on a single line.
|
|
36
|
+
Supplying the current name leaves the modification timestamp unchanged.
|
|
37
|
+
Use `--name="--example"` when a value begins with a dash.
|
|
38
|
+
|
|
29
39
|
Add another column at the end of the board:
|
|
30
40
|
|
|
31
41
|
```sh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zinn-dev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A kanban workflow in the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@zinn-dev/core": "0.
|
|
45
|
+
"@zinn-dev/core": "0.3.0",
|
|
46
46
|
"@zinn-dev/tui": "0.0.1"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,9 +1,61 @@
|
|
|
1
1
|
import type { RouteDef } from "../types";
|
|
2
2
|
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
|
+
|
|
3
5
|
import { column, project } from "@zinn-dev/core";
|
|
4
6
|
import { quit } from "../lib";
|
|
5
7
|
|
|
6
8
|
export const projectRouter = {
|
|
9
|
+
edit: {
|
|
10
|
+
run: (args) => {
|
|
11
|
+
const { values, positionals, tokens } = parseArgs({
|
|
12
|
+
args,
|
|
13
|
+
options: { name: { type: "string" } },
|
|
14
|
+
allowPositionals: true,
|
|
15
|
+
strict: true,
|
|
16
|
+
tokens: true,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const projectKey = positionals[0];
|
|
20
|
+
|
|
21
|
+
if (projectKey == null) {
|
|
22
|
+
quit("Project key must be specified");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (positionals.length > 1) {
|
|
26
|
+
quit("Only one project key can be specified");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const parsedArgs = new Set<string>();
|
|
30
|
+
for (const token of tokens) {
|
|
31
|
+
if (token.kind !== "option") {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (parsedArgs.has(token.name)) {
|
|
36
|
+
quit(`The "--${token.name}" flag can only be specified once`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
parsedArgs.add(token.name);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (values.name === undefined) {
|
|
43
|
+
quit("Provide an edit flag: --name");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const editedProject = project.edit({ projectKey, name: values.name });
|
|
47
|
+
console.info(`${editedProject.key} | ${editedProject.name}`);
|
|
48
|
+
},
|
|
49
|
+
help: `Usage: zinn project edit <project-key> --name <text>
|
|
50
|
+
|
|
51
|
+
Change the project name.
|
|
52
|
+
The --name flag is required.
|
|
53
|
+
|
|
54
|
+
Unchanged names leave the modification timestamp unchanged.
|
|
55
|
+
|
|
56
|
+
Example: zinn project edit MDR --name "Macrodata Refinement"`,
|
|
57
|
+
},
|
|
58
|
+
|
|
7
59
|
create: {
|
|
8
60
|
run: (args: Array<string>) => {
|
|
9
61
|
const projectName = args[0];
|