@dench.com/cli 2.8.3-staging.117 → 2.8.4-staging.154
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/apps.ts +31 -3
- package/crm.ts +609 -86
- package/dench.ts +126 -21
- package/email.ts +255 -41
- package/lib/cli-args.ts +41 -0
- package/lib/command-registry.ts +13 -3
- package/lib/levenshtein.ts +52 -0
- package/package.json +1 -1
- package/tools.ts +98 -8
package/apps.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { ConvexHttpClient } from "convex/browser";
|
|
12
12
|
import { makeFunctionReference } from "convex/server";
|
|
13
|
+
import { closestMatch } from "./lib/levenshtein";
|
|
13
14
|
|
|
14
15
|
const api = {
|
|
15
16
|
listInstalled: makeFunctionReference<"query">(
|
|
@@ -212,7 +213,12 @@ export async function runAppsCommand(opts: {
|
|
|
212
213
|
}
|
|
213
214
|
case "pin":
|
|
214
215
|
case "unpin": {
|
|
215
|
-
const slug =
|
|
216
|
+
const slug = ctx.args.shift();
|
|
217
|
+
if (!slug) {
|
|
218
|
+
throw new AppsCliError(
|
|
219
|
+
`Missing app slug. Usage: dench apps ${sub} <slug>`,
|
|
220
|
+
);
|
|
221
|
+
}
|
|
216
222
|
await ctx.convex.mutation(
|
|
217
223
|
api.setPinned,
|
|
218
224
|
withAuth(ctx, { slug, pinned: sub === "pin" }),
|
|
@@ -220,7 +226,29 @@ export async function runAppsCommand(opts: {
|
|
|
220
226
|
out(ctx, { ok: true, slug, pinned: sub === "pin" });
|
|
221
227
|
return;
|
|
222
228
|
}
|
|
223
|
-
default:
|
|
224
|
-
|
|
229
|
+
default: {
|
|
230
|
+
const suggestion = closestMatch(sub, APPS_SUBCOMMANDS);
|
|
231
|
+
throw new AppsCliError(
|
|
232
|
+
`Unknown apps subcommand: ${sub}` +
|
|
233
|
+
`${suggestion ? `. Did you mean "${suggestion}"?` : ""}` +
|
|
234
|
+
" Run 'dench apps help' for usage.",
|
|
235
|
+
);
|
|
236
|
+
}
|
|
225
237
|
}
|
|
226
238
|
}
|
|
239
|
+
|
|
240
|
+
/** Every verb the dispatcher accepts (for "did you mean" suggestions). */
|
|
241
|
+
const APPS_SUBCOMMANDS = [
|
|
242
|
+
"list",
|
|
243
|
+
"gallery",
|
|
244
|
+
"info",
|
|
245
|
+
"create",
|
|
246
|
+
"install",
|
|
247
|
+
"publish",
|
|
248
|
+
"uninstall",
|
|
249
|
+
"enable",
|
|
250
|
+
"disable",
|
|
251
|
+
"pin",
|
|
252
|
+
"unpin",
|
|
253
|
+
"help",
|
|
254
|
+
] as const;
|