Files
calendar/packages/app-store-cli/src/cli.tsx
T
Hariom BalharaGitHubkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
18e0f13605 [Feature] App Store CLI - Make it super easy to add an app. (#2917)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-06-07 11:43:32 +05:30

50 lines
999 B
TypeScript

#!/usr/bin/env node
import { render } from "ink";
import meow from "meow";
import React from "react";
import App from "./CliApp";
const cli = meow(
`
Usage
$ app-store create/delete/edit - Edit and Delete commands must be used on apps created using cli
Options
[--slug] Slug. This is the name of app dir for apps created with cli.
`,
{
flags: {
noDbUpdate: {
type: "boolean",
},
slug: {
type: "string",
},
},
allowUnknownFlags: false,
}
);
if (cli.input.length !== 1) {
cli.showHelp();
}
const command = cli.input[0] as "create" | "delete" | "edit";
const supportedCommands = ["create", "delete", "edit"];
if (!supportedCommands.includes(command)) {
cli.showHelp();
}
let slug = null;
if (command === "delete" || command === "edit") {
slug = cli.flags.slug;
if (!slug) {
console.log("--slug is required");
cli.showHelp();
}
}
render(<App slug={slug} command={command} noDbUpdate={cli.flags.noDbUpdate} />);