forked from seanshoffman/python-build-cli-planner-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ReTeam Labs
committed
Mar 25, 2020
1 parent
38cef39
commit 953bceb
Showing
9 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
|
||
.git | ||
.gitignore | ||
.gitattributes | ||
Dockerfile | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
FROM python:3.8 | ||
|
||
WORKDIR /app | ||
|
||
COPY requirements.txt /app | ||
RUN pip install -r requirements.txt | ||
|
||
COPY . /app | ||
|
||
CMD ["python", "/app/src/app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.PHONY: test | ||
|
||
default: test | ||
|
||
build: | ||
docker build -t python-build-cli-planner-app . | ||
|
||
test: build | ||
docker run -t python-build-cli-planner-app pytest /app/tests/tests.py | ||
|
||
start: build | ||
docker run -it python-build-cli-planner-app |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest==5.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from database import add_reminder, list_reminders | ||
|
||
def handle_input(input): | ||
if(input == "1"): | ||
list_reminders() | ||
print_menu() | ||
elif(input == "2"): | ||
add_reminder("reminder") | ||
list_reminders() | ||
print_menu() | ||
else: | ||
print("Invalid menu option") | ||
print_menu() | ||
|
||
def print_menu(): | ||
print() | ||
print('|--------------|') | ||
print('| Pluralsight |') | ||
print('| Reminders |') | ||
print('| App |') | ||
print('|--------------|') | ||
print('* * * * * * * * *') | ||
print('Please select an option:') | ||
print() | ||
print('1) List reminders') | ||
print('2) Add a reminder') | ||
choice = input("Choice: ") | ||
handle_input(choice) | ||
|
||
def main(): | ||
print_menu() | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import csv | ||
|
||
def list_reminders(): | ||
f = open("reminders.csv", "r") | ||
|
||
with f: | ||
reader = csv.reader(f) | ||
|
||
for row in reader: | ||
print() | ||
for e in row: | ||
print(e.ljust(32), end=' ') | ||
print() | ||
|
||
def add_reminder(reminder): | ||
print() | ||
reminder = input("What would you like to be reminded about?: ") | ||
|
||
with open('reminders.csv', 'a+', newline='\n') as file: | ||
writer = csv.writer(file) | ||
writer.writerow([reminder]) |
Empty file.