-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
38 lines (31 loc) · 1.07 KB
/
main.ts
File metadata and controls
38 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Args, parseArgs } from "./deps.ts";
import help from "./src/arguments/help.ts";
import version from "./src/arguments/version.ts";
import bootstrap from "./src/bootstrap.ts";
import { app } from "./src/constants.ts";
import all from "./src/subcommands/all/all.ts";
import assets from "./src/subcommands/assets/assets.ts";
import database from "./src/subcommands/database/database.ts";
import { Command } from "./types.ts";
/** The command definition. */
const command: Command = {
run: run,
aliases: [],
description: app.description,
subcommands: [all, assets, database],
optionalArguments: [version, help],
};
/** The arguments entered by the user. */
const userEnteredArgs = parseArgs(Deno.args);
/** The command entered by the user. */
const userEnteredCommand = userEnteredArgs._.shift() as string;
/**
* Process the command(s) and/or argument(s) entered by the user.
*
* @param args The arguments entered by the user.
*/
async function run(args: Args) {
await bootstrap(command, userEnteredCommand, args);
}
command.run(userEnteredArgs);
export default command;