From 89ebc5b8efbc70b3dc6fdce0d42cd2b0a0bb1526 Mon Sep 17 00:00:00 2001 From: Lenka Segura Date: Jan 17 2019 14:15:42 +0000 Subject: add merge pr --- diff --git a/cranc/cranc.py b/cranc/cranc.py index 574d7b8..4af76dc 100644 --- a/cranc/cranc.py +++ b/cranc/cranc.py @@ -57,6 +57,7 @@ def filter_pull_requests(status, assignee, author): _log.exception("Failed to connect to the server") +# Adding pr_list into the group 'get' get.add_command(pr_list) @click.command(name="issues") @@ -84,13 +85,32 @@ def issue_list(status, tags, assignee, author, milestones, priority, no_stones, pprint.pprint(issues) - +# Adding issue_list into the group 'get' get.add_command(issue_list) +# Create subgroup 'merge' +@click.group() +def merge(): + pass + +@click.command(name="pr") +@click.option("--request_id") +def merge_pr(request_id): + """This command merges a pull request""" + try: + request = PAGURE.merge_request(request_id=request_id) + pprint.pprint(request) + print("Pull request succesfully merged") + except Exception: + _log.exception("Failed to connect to the server") + +# Adding merge_pr into the group 'merge' +merge.add_command(merge_pr) + ################################################################################ # General section ################################################################################ cranc.add_command(get) - +cranc.add_command(merge)