def main(): """Main command loop""" profile = core.loadProfile() commands = { "add": mainAdd, "search": mainSearch, #"save":mainSave, # "open":profile.openDB, # "close":profile.closeDB, # "template":profile.template, } while True: print("Please choose a command from the list: ") for command in commands: print(CONST.DISP + command) print(CONST.DISP + 'quit') userCommand = input(CONST.PROMPT).lower() if userCommand == 'quit' or userCommand == 'exit': profile.save(core.CONST.SAVE_BACKUP) break if userCommand in commands: commands[userCommand](profile) #Save after operations profile.save(core.CONST.SAVE_LOCATION) else: print("Sorry, don't recognize '%s', try again." % (userCommand)) return
def initCore(): profile = core.loadProfile() return profile