-
Notifications
You must be signed in to change notification settings - Fork 0
/
CLI.py
39 lines (30 loc) · 877 Bytes
/
CLI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from PyInquirer import prompt, style_from_dict, Token
import sys
def run_program(choice):
if choice == "Caesar Cipher":
path = "Caesar_cipher.py"
elif choice == "One-Time Pad":
path = "XOR_cipher.py"
with open(path, "rb") as f:
code = f.read()
exec(code)
custom_style = style_from_dict({
Token.Separator: '#2d60bf',
Token.QuestionMark: '#ff591d bold',
Token.Selected: '#6dff43 bold', # default
Token.Pointer: '#ff591d bold',
Token.Instruction: '#ff591d bold', # default
Token.Answer: '#92d84b bold',
Token.Question: '#fff79a',
})
questions = [
{
"type": "list",
"name": "program",
"message": "Select a Cipher :",
"choices": ["Caesar Cipher", "One-Time Pad"],
}
]
answers = prompt(questions,style=custom_style)
choice = answers["program"]
run_program(choice)