@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.
Files changed (93) hide show
  1. package/README.md +5 -2
  2. package/index.d.ts +2 -0
  3. package/index.js +23 -0
  4. package/package.json +22 -18
  5. package/src/actor.d.ts +6 -0
  6. package/src/actor.js +62 -0
  7. package/src/database.d.ts +6 -0
  8. package/src/database.js +27 -0
  9. package/src/lib.d.ts +31 -0
  10. package/src/lib.js +137 -0
  11. package/src/presentation/activity-presentation.d.ts +23 -0
  12. package/src/presentation/activity-presentation.js +389 -0
  13. package/src/presentation/color.d.ts +9 -0
  14. package/src/presentation/color.js +21 -0
  15. package/src/presentation/column-presentation.d.ts +16 -0
  16. package/src/presentation/column-presentation.js +29 -0
  17. package/src/presentation/description-presentation.d.ts +3 -0
  18. package/src/presentation/description-presentation.js +11 -0
  19. package/src/presentation/row-layout.d.ts +22 -0
  20. package/src/presentation/row-layout.js +58 -0
  21. package/src/presentation/section.d.ts +4 -0
  22. package/src/presentation/section.js +9 -0
  23. package/src/presentation/task-presentation.d.ts +17 -0
  24. package/src/presentation/task-presentation.js +62 -0
  25. package/src/presentation/time.d.ts +1 -0
  26. package/src/presentation/time.js +13 -0
  27. package/src/project.d.ts +6 -0
  28. package/src/project.js +31 -0
  29. package/src/release-identity.d.ts +2 -0
  30. package/src/release-identity.js +1 -0
  31. package/src/routes/activity-router.d.ts +10 -0
  32. package/src/routes/{activity-router.ts → activity-router.js} +36 -46
  33. package/src/routes/backup-router.d.ts +4 -0
  34. package/src/routes/backup-router.js +18 -0
  35. package/src/routes/comment-router.d.ts +24 -0
  36. package/src/routes/comment-router.js +134 -0
  37. package/src/routes/label-router.d.ts +18 -0
  38. package/src/routes/label-router.js +136 -0
  39. package/src/routes/migrate-router.d.ts +4 -0
  40. package/src/routes/migrate-router.js +37 -0
  41. package/src/routes/project-router.d.ts +40 -0
  42. package/src/routes/project-router.js +328 -0
  43. package/src/routes/reindex-router.d.ts +4 -0
  44. package/src/routes/reindex-router.js +21 -0
  45. package/src/routes/relation-router.d.ts +28 -0
  46. package/src/routes/relation-router.js +163 -0
  47. package/src/routes/restore-router.d.ts +4 -0
  48. package/src/routes/restore-router.js +71 -0
  49. package/src/routes/router.d.ts +6 -0
  50. package/src/routes/router.js +185 -0
  51. package/src/routes/routes.d.ts +170 -0
  52. package/src/routes/routes.js +19 -0
  53. package/src/routes/task-router.d.ts +84 -0
  54. package/src/routes/task-router.js +533 -0
  55. package/src/text-edit.d.ts +25 -0
  56. package/src/text-edit.js +45 -0
  57. package/src/types.d.ts +10 -0
  58. package/src/types.js +1 -0
  59. package/index.ts +0 -26
  60. package/release-stamp.json +0 -1
  61. package/src/actor.test.ts +0 -41
  62. package/src/actor.ts +0 -78
  63. package/src/database.test.ts +0 -70
  64. package/src/database.ts +0 -41
  65. package/src/lib.test.ts +0 -86
  66. package/src/lib.ts +0 -159
  67. package/src/presentation/activity-presentation.test.ts +0 -112
  68. package/src/presentation/activity-presentation.ts +0 -490
  69. package/src/presentation/color.ts +0 -29
  70. package/src/presentation/column-presentation.ts +0 -48
  71. package/src/presentation/description-presentation.ts +0 -18
  72. package/src/presentation/row-layout.ts +0 -77
  73. package/src/presentation/section.ts +0 -16
  74. package/src/presentation/task-presentation.ts +0 -92
  75. package/src/presentation/time.ts +0 -17
  76. package/src/project.test.ts +0 -479
  77. package/src/project.ts +0 -53
  78. package/src/routes/backup-router.ts +0 -24
  79. package/src/routes/comment-router.ts +0 -171
  80. package/src/routes/label-router.ts +0 -168
  81. package/src/routes/migrate-router.test.ts +0 -31
  82. package/src/routes/migrate-router.ts +0 -48
  83. package/src/routes/project-router.ts +0 -415
  84. package/src/routes/reindex-router.ts +0 -27
  85. package/src/routes/relation-router.ts +0 -194
  86. package/src/routes/restore-router.test.ts +0 -44
  87. package/src/routes/restore-router.ts +0 -90
  88. package/src/routes/router.test.ts +0 -136
  89. package/src/routes/router.ts +0 -248
  90. package/src/routes/routes.ts +0 -20
  91. package/src/routes/task-router.ts +0 -649
  92. package/src/text-edit.ts +0 -68
  93. 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
- }
package/src/types.ts DELETED
@@ -1,6 +0,0 @@
1
- export type Command = { run: (args: Array<string>) => void; help: string };
2
- export type ParsedRoute = {
3
- command: string;
4
- } & Command;
5
-
6
- export type RouteDef = { [key: string]: Command | RouteDef };