This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
pushee/pushee.py
2019-12-01 13:23:03 +01:00

45 lines
1.1 KiB
Python

#!/usr/bin/env python3
import sys
from commands import MergeRequests, UpdateAssignees, Comments, Merge, Test
from kontr_emails import Parser
COMMANDS = {
"mrs": MergeRequests,
"update-assignees": UpdateAssignees,
"comments": Comments,
"merge": Merge,
"test": Test,
}
def print_usage():
print(f"{sys.argv[0]} <path_to_mbox> <homework> <correction> <deadline> <command>")
print()
print("Commands:")
print("\tmrs\t\t\tFetch files and create merge requests for them")
print("\tupdate-assignees\tUpdate assignees on MRs")
print("\tcomments\t\tFetch all comments on MRs")
print("\tmerge\t\t\tMerge all MRs")
print("\ttest\t\t\tDebugging function")
print("Format of date: %Y_%m%d_%H%M%S")
def main():
if len(sys.argv) != 6 or sys.argv[5] not in COMMANDS:
print_usage()
exit(2)
_, path, hw, correction, deadline, command = sys.argv
correction = correction == "y"
submissions = Parser(path, deadline, correction).parse(hw)
COMMANDS[command](submissions)()
if __name__ == "__main__":
main()