Skip to content

Commit 721e41f

Browse files
author
daria-z
committed
add readline-sync
1 parent 1105e8e commit 721e41f

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

bin/brain-games.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
#!/usr/bin/env node
2-
console.log("Welcome to the Brain Games!");
2+
import { game } from "../src/cli.js";
3+
4+
game();

package-lock.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"brain-games": "bin/brain-games.js"
1212
},
1313
"author": "",
14-
"license": "ISC"
14+
"license": "ISC",
15+
"dependencies": {
16+
"readline-sync": "^1.4.10"
17+
}
1518
}

src/cli.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import readlineSync from 'readline-sync';
2+
3+
export const game = () => {
4+
console.log("Welcome to the Brain Games!");
5+
6+
const name = readlineSync.question("May I have your name? ");
7+
8+
console.log("Hello, " + name + "!");
9+
};

0 commit comments

Comments
 (0)