forked from microsoft/devicescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
52 lines (46 loc) · 1.76 KB
/
cli.ts
File metadata and controls
52 lines (46 loc) · 1.76 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { program } from "commander"
import pkg from "../package.json"
import { build } from "./build"
import { devtools } from "./devtools"
import init from "./init"
export async function mainCli() {
program
.name("DeviceScript")
.description(
"build and run DeviceScript program https://aka.ms/devicescript"
)
.version(pkg.version)
.option("-v, --verbose", "more logging")
program
.command("build", { isDefault: true })
.description("build a DeviceScript file")
.option("-s, --stats", "show additional size information")
.option("-l, --library", "build library")
.option("--no-verify", "don't verify resulting bytecode")
.option("-o", "--out-dir", "output directory, default is 'built'")
.option("-w, --watch", "watch file changes and rebuild automatically")
.option("--internet", "allow connections from non-localhost")
.option(
"--localhost",
"use localhost:8000 instead of the internet dashboard"
)
.arguments("[file.ts]")
.action(build)
program
.command("init")
.description("configures the current directory for devicescript")
.option("-f, --force", "force overwrite existing files")
.option("--spaces <number>", "number of spaces when generating JSON")
.action(init)
program
.command("devtools")
.description("launches a local deveplopement tools server")
.option("--internet", "allow connections from non-localhost")
.option(
"--localhost",
"use localhost:8000 instead of the internet dashboard"
)
.action(devtools)
program.parse(process.argv)
}
if (require.main === module) mainCli()