-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
54 lines (38 loc) · 1.24 KB
/
index.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
import "./imports/index.ts";
const env = Deno.env;
let url = Deno.cwd() + "/" + env.get('tool');
async function runCli() {
try {
let cloudUrl = env.get('toolCloud')
// console.log(Deno.env.toObject());
console.log("Hello",env.get('USERNAME'))
if (Deno.args[0] == "cloud" && cloudUrl) {
console.log('getting cloud version')
url= cloudUrl.toString()
} else {
console.log('init local version')
}
const gitProcess = Deno.run({
cmd: ["deno", "run", "--allow-read", "--allow-write", "--allow-run","--allow-env", `${url}/core/cli.ts`, ...Deno.args],
stderr: "piped",
});
const { code } = await gitProcess.status();
if (code === 0) {
//const rawOutput = await gitProcess.output();
// await Deno.stdout.write(rawOutput);
// const rawInput = await gitProcess.stdin.write();
//await Deno.stdout.write(rawOutput);
} else {
const rawError = await gitProcess.stderrOutput();
const errorString = new TextDecoder().decode(rawError);
console.log(errorString, "please indicate the project you would like to create");
}
Deno.exit(code);
}
catch (e) {
console.log("failing to do something", e)
}
}
if (import.meta.main) {
runCli();
}