mirror of
https://github.com/rjNemo/deno_hello
synced 2026-06-12 12:56:38 +00:00
refactor: cli
This commit is contained in:
parent
664e62b1b1
commit
5a7dc56b51
1 changed files with 9 additions and 10 deletions
15
src/index.ts
15
src/index.ts
|
|
@ -10,18 +10,17 @@ const start = async () => {
|
||||||
console.log("👉 ");
|
console.log("👉 ");
|
||||||
|
|
||||||
for await (const line of readLines(Deno.stdin)) {
|
for await (const line of readLines(Deno.stdin)) {
|
||||||
switch (line.trim()) {
|
const value = line.trim();
|
||||||
case "": {
|
|
||||||
|
if (value === "") {
|
||||||
console.log(sayRandomHello());
|
console.log(sayRandomHello());
|
||||||
break;
|
} else if (value === "quit") {
|
||||||
}
|
return;
|
||||||
default: {
|
} else {
|
||||||
const id = new ID(parseInt(line.trim(), 10));
|
const id = new ID(parseInt(value, 10));
|
||||||
console.log(sayHello(id));
|
console.log(sayHello(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await start();
|
await start();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue