def manual_menu(target): """ Present the main menu """ while True: try: lookup = { "automated process": automated_process, "automated work queue": multiworker_main, "clear work queue": clear_work_queue, "show work queue": show_work_queue, "examine a repository": examine_repo_selection, "manually add a new repository": manually_add_new_repo, "remove a repository": remove_repo_selection, "add a new repository": add_new_repo, "prepare a change": prepare_a_change, "prepare a pr/issue": prepare_a_pr_or_issue, "total annihilation": total_annihilation, } handler = make_choice(lookup) if handler is None: print("Goodbye.") return handler(target) except ProcessingFailed: continue
def prepare_a_pr_or_issue_for(reponame, reposave): """ Access repository to prepare a change """ try: while True: repodir = reposave["repodir"] repodirpath = Path(repodir) choices = get_pr_or_issue_choices(reponame, repodirpath) option = make_choice(choices) if option is None: return handler, context = option handler(reponame, reposave, context) except UserCancel: print("quit - returning to main process")
def make_choice(self, choices, message="Please make a selection."): """ Get arbitrary choice input """ return _input.make_choice(choices=choices, message=message)