Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import yaml
- from getpass import getpass
- from common.general import clear_screen
- import os, sys
- menu = {}
- menu[1] = {'text': 'Dump owners', 'command': 'dump_owners.py'}
- menu[2] = {'text': 'Run spreadsheets proof', 'command': 'run_proofs.py {last_report_date} all'}
- menu[3] = {'text': 'Dump owners', 'command': 'dump_owners.py'}
- menu[99] = {'text': 'Exit', 'command': 'exit'}
- # clear_screen()
- print('')
- print('')
- with open('config.yaml', "r") as f:
- cfg = yaml.load(f)
- last_report_date = cfg['config']['last_report_date']
- while True:
- for key, value in menu.items():
- print('{0:>4}. {1}'.format(key, value['text']))
- while True:
- try:
- option = input("Enter menu item (or x to cancel): ")
- if option == 'x':
- os._exit(0)
- option = int(option)
- if option in menu:
- print('')
- break
- except:
- print('invalid response... please try again.')
- command = menu[option]
- if command['command'] == 'exit':
- sys.exit()
- cmd = command['command'].replace('{last_report_date}', last_report_date)
- print('Running: ' + cmd)
- os.system('python ' + cmd)
- print('')
- # print(
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement