Skip to content

Commit 22f7968

Browse files
committed
Add getting name from user & update dependencies
1 parent 7b841be commit 22f7968

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

bin/brain-games.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
#!/usr/bin/env node
22

3+
import { getName } from '../src/cli.js';
4+
5+
getName();
36
console.log('Welcome to the Brain Games!');

package-lock.json

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
},
2020
"bin": {
2121
"brain-games": "bin/brain-games.js"
22+
},
23+
"dependencies": {
24+
"readline-sync": "^1.4.10"
2225
}
2326
}

src/cli.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import readlineSync from 'readline-sync';
2+
3+
export const getName = () => {
4+
const name = readlineSync.question('May I have your name? ');
5+
console.log(`Hello, ${name}!`);
6+
};

0 commit comments

Comments
 (0)