-
Notifications
You must be signed in to change notification settings - Fork 1
/
zcli.ts
62 lines (53 loc) · 1.29 KB
/
zcli.ts
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
53
54
55
56
57
58
59
60
61
62
import {
flag,
flags,
inferContext,
init,
} from "https://deno.land/x/[email protected]/mod.ts";
import { COMMIT, VERSION } from "./version.ts";
export const context = {
meta: {
version: VERSION,
commit: COMMIT,
date: new Date().toISOString(),
},
};
export const logLevels = [
"debug",
"info",
"warning",
"error",
"critical",
] as const;
export const app = init({
ctx: context,
globalFlags: flags({
"log-level": flag({
short: "Enable debug logging",
long: `Enable debug logging.`,
aliases: ["l"],
})
.enum(logLevels).optional(),
json: flag({
short: "Output JSON",
aliases: ["j"],
}).oboolean(),
"api-key": flag({
short: "A Paperspace public API Key used for authenticating requests",
}).ostring(),
"api-url": flag({
short: `A URL for the Paperspace API.`,
hidden: true,
}).ostring(),
}),
});
export type Context = inferContext<typeof app>;
export const { command } = app;
export * from "https://deno.land/x/[email protected]/mod.ts";
export type {
Join,
NestedKeys,
NestedValue,
} from "https://deno.land/x/[email protected]/lib/types.ts";
export { textEncoder } from "https://deno.land/x/[email protected]/lib/text-encoder.ts";
export { table } from "https://deno.land/x/[email protected]/lib/simple-table.ts";