@zinn-dev/cli 0.39.0 → 0.40.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 +5 -2
- package/index.d.ts +2 -0
- package/index.js +23 -0
- package/package.json +22 -18
- package/src/actor.d.ts +6 -0
- package/src/actor.js +62 -0
- package/src/database.d.ts +6 -0
- package/src/database.js +27 -0
- package/src/lib.d.ts +31 -0
- package/src/lib.js +137 -0
- package/src/presentation/activity-presentation.d.ts +23 -0
- package/src/presentation/activity-presentation.js +389 -0
- package/src/presentation/color.d.ts +9 -0
- package/src/presentation/color.js +21 -0
- package/src/presentation/column-presentation.d.ts +16 -0
- package/src/presentation/column-presentation.js +29 -0
- package/src/presentation/description-presentation.d.ts +3 -0
- package/src/presentation/description-presentation.js +11 -0
- package/src/presentation/row-layout.d.ts +22 -0
- package/src/presentation/row-layout.js +58 -0
- package/src/presentation/section.d.ts +4 -0
- package/src/presentation/section.js +9 -0
- package/src/presentation/task-presentation.d.ts +17 -0
- package/src/presentation/task-presentation.js +62 -0
- package/src/presentation/time.d.ts +1 -0
- package/src/presentation/time.js +13 -0
- package/src/project.d.ts +6 -0
- package/src/project.js +31 -0
- package/src/release-identity.d.ts +2 -0
- package/src/release-identity.js +1 -0
- package/src/routes/activity-router.d.ts +10 -0
- package/src/routes/{activity-router.ts → activity-router.js} +36 -46
- package/src/routes/backup-router.d.ts +4 -0
- package/src/routes/backup-router.js +18 -0
- package/src/routes/comment-router.d.ts +24 -0
- package/src/routes/comment-router.js +134 -0
- package/src/routes/label-router.d.ts +18 -0
- package/src/routes/label-router.js +136 -0
- package/src/routes/migrate-router.d.ts +4 -0
- package/src/routes/migrate-router.js +37 -0
- package/src/routes/project-router.d.ts +40 -0
- package/src/routes/project-router.js +328 -0
- package/src/routes/reindex-router.d.ts +4 -0
- package/src/routes/reindex-router.js +21 -0
- package/src/routes/relation-router.d.ts +28 -0
- package/src/routes/relation-router.js +163 -0
- package/src/routes/restore-router.d.ts +4 -0
- package/src/routes/restore-router.js +71 -0
- package/src/routes/router.d.ts +6 -0
- package/src/routes/router.js +185 -0
- package/src/routes/routes.d.ts +170 -0
- package/src/routes/routes.js +19 -0
- package/src/routes/task-router.d.ts +84 -0
- package/src/routes/task-router.js +533 -0
- package/src/text-edit.d.ts +25 -0
- package/src/text-edit.js +45 -0
- package/src/types.d.ts +10 -0
- package/src/types.js +1 -0
- package/index.ts +0 -26
- package/release-stamp.json +0 -1
- package/src/actor.test.ts +0 -41
- package/src/actor.ts +0 -78
- package/src/database.test.ts +0 -70
- package/src/database.ts +0 -41
- package/src/lib.test.ts +0 -86
- package/src/lib.ts +0 -159
- package/src/presentation/activity-presentation.test.ts +0 -112
- package/src/presentation/activity-presentation.ts +0 -490
- package/src/presentation/color.ts +0 -29
- package/src/presentation/column-presentation.ts +0 -48
- package/src/presentation/description-presentation.ts +0 -18
- package/src/presentation/row-layout.ts +0 -77
- package/src/presentation/section.ts +0 -16
- package/src/presentation/task-presentation.ts +0 -92
- package/src/presentation/time.ts +0 -17
- package/src/project.test.ts +0 -479
- package/src/project.ts +0 -53
- package/src/routes/backup-router.ts +0 -24
- package/src/routes/comment-router.ts +0 -171
- package/src/routes/label-router.ts +0 -168
- package/src/routes/migrate-router.test.ts +0 -31
- package/src/routes/migrate-router.ts +0 -48
- package/src/routes/project-router.ts +0 -415
- package/src/routes/reindex-router.ts +0 -27
- package/src/routes/relation-router.ts +0 -194
- package/src/routes/restore-router.test.ts +0 -44
- package/src/routes/restore-router.ts +0 -90
- package/src/routes/router.test.ts +0 -136
- package/src/routes/router.ts +0 -248
- package/src/routes/routes.ts +0 -20
- package/src/routes/task-router.ts +0 -649
- package/src/text-edit.ts +0 -68
- package/src/types.ts +0 -6
package/src/text-edit.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { TextEdit } from "@zinn-dev/core";
|
|
2
|
-
|
|
3
|
-
import { quit } from "./lib";
|
|
4
|
-
|
|
5
|
-
/** The flags that change how a text flag (--description, --text) is applied to the stored text. */
|
|
6
|
-
export const textEditOptions = {
|
|
7
|
-
append: { type: "boolean" },
|
|
8
|
-
replacing: { type: "string" },
|
|
9
|
-
all: { type: "boolean" },
|
|
10
|
-
} as const;
|
|
11
|
-
|
|
12
|
-
type TextEditFlags = {
|
|
13
|
-
append?: boolean | undefined;
|
|
14
|
-
replacing?: string | undefined;
|
|
15
|
-
all?: boolean | undefined;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** The usage form of the text-edit flags, to follow the text flag in a usage line. */
|
|
19
|
-
export const textEditUsage = "[--append|--replacing <old> [--all]]";
|
|
20
|
-
|
|
21
|
-
/** Help paragraph for the text-edit flags of a command whose text flag is `textFlag`. */
|
|
22
|
-
export function textEditHelp(textFlag: "--description" | "--text") {
|
|
23
|
-
return `With --append, the ${textFlag} text is added as a new paragraph.
|
|
24
|
-
With --replacing <old>, it replaces the one exact, case-sensitive match of <old>
|
|
25
|
-
--all replaces every match.
|
|
26
|
-
|
|
27
|
-
No match, or several matches without --all, fails without changing anything.
|
|
28
|
-
An empty ${textFlag} with --replacing deletes the match.`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** The value to send to core for a text flag: the full text, or one edit object. */
|
|
32
|
-
export function resolveTextEdit(
|
|
33
|
-
text: string | undefined,
|
|
34
|
-
flags: TextEditFlags,
|
|
35
|
-
textFlag: "--description" | "--text",
|
|
36
|
-
): string | TextEdit | undefined {
|
|
37
|
-
const isAppending = flags.append === true;
|
|
38
|
-
const isReplacing = flags.replacing !== undefined;
|
|
39
|
-
|
|
40
|
-
if (isAppending && isReplacing) {
|
|
41
|
-
quit(`Option "--append" cannot be used with "--replacing"`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if ((isAppending || isReplacing) && text === undefined) {
|
|
45
|
-
const modifier = isAppending ? "--append" : "--replacing";
|
|
46
|
-
quit(`Option "${modifier}" needs "${textFlag}"`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (flags.all === true && !isReplacing) {
|
|
50
|
-
quit(`Option "--all" needs "--replacing"`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (text === undefined) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (isAppending) {
|
|
58
|
-
return { append: text };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (flags.replacing !== undefined) {
|
|
62
|
-
return flags.all === true
|
|
63
|
-
? { find: flags.replacing, replace: text, all: true }
|
|
64
|
-
: { find: flags.replacing, replace: text };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return text;
|
|
68
|
-
}
|