-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshell.ts
More file actions
35 lines (30 loc) · 901 Bytes
/
Copy pathshell.ts
File metadata and controls
35 lines (30 loc) · 901 Bytes
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
import "auto";
export default auto({
id: "shell",
title: "Shell-like usage",
run: async ({ project }) => {
cd(project.rootDirectory);
console.log((await execa("cat", ["package.json"]).pipe("grep", ["license"])).stdout);
const whoami = await $`whoami`;
await $({ stdout: ["pipe", "inherit"] })`echo "Hello, ${whoami}"`;
console.log(
(
await Promise.all(
[
async () => {
await sleep(100);
return $({ stdout: ["pipe", "inherit"] })`echo "1"`;
},
async () => {
await sleep(200);
return $({ stdout: ["pipe", "inherit"] })`echo "2"`;
},
].map((f) => f())
)
).map((p) => p?.stdout)
);
const name = "auto-foo-bar-baz";
await $`mkdir -p /tmp/${name}`;
console.log((await $`ls /tmp/${name}`).exitCode);
},
});