-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
executable file
·40 lines (32 loc) · 1.24 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import sys
import actions
import argparse
ARGS: argparse.Namespace
def parse_args() -> None:
global ARGS
argument_parser = argparse.ArgumentParser(prog="github-manager", description="Manages some shit in GitHub")
argument_parser.add_argument("--token", "-t", help="GitHub Personal Access Token (PAT) to use for auth")
argument_parser.add_argument("--action", "-a", help="What action to take")
argument_parser.add_argument("--org", "-o", help="The GitHub org to target for operations")
argument_parser.add_argument("--team", "-T", help="Team name to target for operation")
argument_parser.add_argument("--access", "-A", help="Access level to give (admin, maintain, pull, push, triage)")
argument_parser.add_argument("--force", "-f", help="Force changes", action="store_true")
ARGS = argument_parser.parse_args()
return
def main():
global ARGS
if not ARGS.action:
print("You must supply an --action !")
sys.exit(1)
try:
session = actions._session(pat=ARGS.token)
fn = getattr(actions, ARGS.action)
fn(g=session, args=ARGS)
except Exception as e:
print(e)
return
if __name__ == "__main__":
parse_args()
print(ARGS)
main()