Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a 'clear screen' command in CLI #43 #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Visit the **python** channel and ping `2Y` for assistance.
- `4`: Load an existing password file.
- `5`: Add a new password to the file.
- `6`: Retrieve a password from the file.
- `c`: Clear the CLI
- `q`: Quit the application.

---
Expand Down
15 changes: 12 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os #will allow user to interact with the operating system
from manager import PasswordManager
import pyperclip
import sys
Expand Down Expand Up @@ -39,7 +40,8 @@ def validate_key_loaded(pm : PasswordManager):
print("Key not loaded. Please load a key first.")
return False
return True

def clear_screen(): #Defining the clear screen function to clear the CLI.
os.system('cls' if os.name == 'nt' else 'clear') #'cls' is used to clear the terminal screen in windows, for Linux, MacOS etc. 'clear' is used
def main():
password = {
"gmail": "password1",
Expand All @@ -49,16 +51,19 @@ def main():

pm = PasswordManager()

print("""What would you like to do?
menu = """What would you like to do?
1. Create a new key
2. Load an existing key
3. Create a new password file
4. Load an existing password file
5. Add a password
6. Get a password
7. List all sites
c. Clear Screen
q. Quit
""")
"""

print(menu)

done = False
while not done:
Expand Down Expand Up @@ -104,6 +109,10 @@ def main():
print("Saved Sites:")
for site in pm.password_dict:
print(site)
elif choice == 'c': #CHECK CONDITION AND CLEAR THE CLI
clear_screen()
print(menu)
print("Cleared the screen.")
elif choice == 'q':
done = True
print("Goodbye!")
Expand Down