diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/.login.txt b/.login.txt new file mode 100644 index 0000000..e69de29 diff --git a/options/login.py b/options/login.py new file mode 100644 index 0000000..803e669 --- /dev/null +++ b/options/login.py @@ -0,0 +1,20 @@ +from __future__ import print_function, unicode_literals +from PyInquirer import prompt, print_json +import os + +def login(): + questions = [ + { + 'type': 'input', + 'name': 'user_name', + 'message': 'What\'s your first name', + }, + { + 'type': 'password', + 'name': 'passwd', + 'message': 'Password?', + }, + ] + + answers = prompt(questions) + print_json(answers) # use the answers as input for your app \ No newline at end of file diff --git a/run.py b/run.py index 3219ed7..765cb3e 100644 --- a/run.py +++ b/run.py @@ -1,13 +1,30 @@ from __future__ import print_function, unicode_literals from PyInquirer import prompt, print_json +import os + +def login(): + questions = [ + { + 'type': 'input', + 'name': 'user_name', + 'message': 'What\'s your first name', + }, + { + 'type': 'password', + 'name': 'passwd', + 'message': 'Password?', + }, + ] + answers = prompt(questions) + print(answers) + f = open(".login.txt", "w") + f.write(str(answers["user_name"])) + print_json(answers) # use the answers as input for your app + +if(os.path.exists(".login.txt") == False): + login() +else: + print("Hello!") + -questions = [ - { - 'type': 'input', - 'name': 'first_name', - 'message': 'What\'s your first name', - } -] -answers = prompt(questions) -print_json(answers["name"]) # use the answers as input for your app \ No newline at end of file