Skip to content

Commit de856f0

Browse files
committed
add cli.py (welcome_user function), add Makefile commands, update .gitignore
1 parent 64f2e06 commit de856f0

File tree

6 files changed

+29
-4
lines changed

6 files changed

+29
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__pycache__
1+
__pycache__/
22

33
.venv/
44
dist/

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ publish:
1010
package-install:
1111
python -m pip install --user dist/*.whl
1212

13+
package-reinstall:
14+
pip install --upgrade --force-reinstall dist/*.whl
15+
1316

1417
brain-games:
1518
poetry run brain-games

brain_games/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import prompt
2+
3+
def welcome_user():
4+
username = prompt.string(
5+
'Welcome to the Brain Games!\n'
6+
'May I have your name? '
7+
)
8+
print(f'Hello, {username}!')

brain_games/scripts/brain_games.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env python3
2+
from brain_games.cli import welcome_user
3+
24

35
def main():
4-
print('Welcome to the Brain Games!')
6+
welcome_user()
7+
58

69
if __name__ == '__main__':
710
main()

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ packages = [
1010

1111
[tool.poetry.dependencies]
1212
python = "^3.12"
13+
prompt = "^0.4.1"
1314

1415
[tool.poetry.scripts]
1516
brain-games = "brain_games.scripts.brain_games:main"

0 commit comments

Comments
 (0)