gitraze 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitraze-0.2.3 → gitraze-0.2.4}/PKG-INFO +1 -1
- gitraze-0.2.4/gitraze/cli.py +61 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/config.py +2 -9
- gitraze-0.2.4/gitraze/handlers/analyze.py +7 -0
- gitraze-0.2.4/gitraze/handlers/repo.py +19 -0
- gitraze-0.2.4/gitraze/handlers/search.py +26 -0
- gitraze-0.2.4/gitraze/handlers/user.py +13 -0
- gitraze-0.2.4/gitraze/utils/__init__.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze.egg-info/PKG-INFO +1 -1
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze.egg-info/SOURCES.txt +5 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/pyproject.toml +1 -1
- gitraze-0.2.3/gitraze/cli.py +0 -116
- {gitraze-0.2.3 → gitraze-0.2.4}/LICENSE +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/README.md +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/__init__.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/core/__init__.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/core/api_graphql.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/core/api_rest.py +0 -0
- {gitraze-0.2.3/gitraze/modules → gitraze-0.2.4/gitraze/handlers}/__init__.py +0 -0
- {gitraze-0.2.3/gitraze/utils → gitraze-0.2.4/gitraze/modules}/__init__.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/modules/analytics.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/modules/repo.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/modules/search.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/modules/user.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze/utils/helpers.py +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze.egg-info/dependency_links.txt +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze.egg-info/entry_points.txt +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze.egg-info/requires.txt +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/gitraze.egg-info/top_level.txt +0 -0
- {gitraze-0.2.3 → gitraze-0.2.4}/setup.cfg +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from gitraze.handlers.user import handle_user
|
|
3
|
+
from gitraze.handlers.repo import handle_repo
|
|
4
|
+
from gitraze.handlers.search import handle_search
|
|
5
|
+
from gitraze.handlers.analyze import handle_analysis
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
prog="gitraze",
|
|
11
|
+
description="GitRaze CLI Tool"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
# Global flag
|
|
15
|
+
parser.add_argument(
|
|
16
|
+
"--version",
|
|
17
|
+
action="version",
|
|
18
|
+
version="gitraze 0.2.4"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
22
|
+
|
|
23
|
+
# --- USER ---
|
|
24
|
+
user_parser = subparsers.add_parser("user", help="Fetch user info (GitHub username)")
|
|
25
|
+
user_parser.add_argument("username", help="Format: username")
|
|
26
|
+
user_parser.set_defaults(func=handle_user)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# --- REPO ---
|
|
30
|
+
repo_parser = subparsers.add_parser("repo", help="Fetch repo info (Repository in owner/repo format)")
|
|
31
|
+
repo_parser.add_argument("repo", help="Format: owner/repo")
|
|
32
|
+
repo_parser.set_defaults(func=handle_repo)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# --- SEARCH ---
|
|
36
|
+
search_parser = subparsers.add_parser("search", help="Search GitHub")
|
|
37
|
+
search_parser.add_argument("category",choices=["repos", "users", "issues", "prs", "topics"],help="repos | users | issues | prs | topics")
|
|
38
|
+
search_parser.add_argument("query", nargs="+", help="Search category (repos, users, issues, topics)")
|
|
39
|
+
search_parser.add_argument("-n", "--limit", type=int, default=1, help="Number of results to show")
|
|
40
|
+
search_parser.set_defaults(func=handle_search)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# --- ANALYZE ---
|
|
44
|
+
analyze_parser = subparsers.add_parser("analyze", help="Analyze target")
|
|
45
|
+
analyze_parser.add_argument("target", nargs="+")
|
|
46
|
+
analyze_parser.set_defaults(func=handle_analysis)
|
|
47
|
+
|
|
48
|
+
args = parser.parse_args()
|
|
49
|
+
args.func(args)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
main()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
@@ -7,16 +7,9 @@ REST_BASE_URL = "https://api.github.com"
|
|
|
7
7
|
GRAPHQL_URL = "https://api.github.com/graphql"
|
|
8
8
|
DEFAULT_TIMEOUT = 10
|
|
9
9
|
DEFAULT_HEADERS = {
|
|
10
|
-
"Accept": "application/vnd.github+json"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
# --- USER CONFIG ---
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# --- REPO CONFIG ---
|
|
17
|
-
|
|
10
|
+
"Accept": "application/vnd.github+json"}
|
|
18
11
|
|
|
19
|
-
# --- SEARCH CONFIG
|
|
12
|
+
# --- SEARCH CATEGORIES CONFIG ---
|
|
20
13
|
SEARCH_MAP = {
|
|
21
14
|
"repos": "repositories",
|
|
22
15
|
"users": "users",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from gitraze.utils.helpers import pretty_print
|
|
2
|
+
from gitraze.modules.repo import get_repo_rest
|
|
3
|
+
|
|
4
|
+
def handle_repo(args):
|
|
5
|
+
print("[+] Fetching repository data...")
|
|
6
|
+
parts = args.repo.split("/")
|
|
7
|
+
|
|
8
|
+
if len(parts) != 2:
|
|
9
|
+
print("Invalid format. Use: owner/repo")
|
|
10
|
+
return
|
|
11
|
+
owner, repo = parts
|
|
12
|
+
data = get_repo_rest(owner, repo)
|
|
13
|
+
|
|
14
|
+
if "error" in data:
|
|
15
|
+
print(data["error"])
|
|
16
|
+
return
|
|
17
|
+
|
|
18
|
+
print("[✓] Done")
|
|
19
|
+
pretty_print(data, title=f"User: {owner}, Repository: {repo}")
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from gitraze.utils.helpers import pretty_print
|
|
2
|
+
from gitraze.modules.search import get_search_rest
|
|
3
|
+
|
|
4
|
+
def handle_search(args):
|
|
5
|
+
category = args.category
|
|
6
|
+
|
|
7
|
+
raw_query = " ".join(args.query)
|
|
8
|
+
clean_query = raw_query.replace('"', '')
|
|
9
|
+
query = f'"{clean_query}"'
|
|
10
|
+
|
|
11
|
+
print(f"[+] Searching {category} for {query}...")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
data = get_search_rest(category, query, args.limit)
|
|
15
|
+
|
|
16
|
+
if "error" in data:
|
|
17
|
+
print(data["error"])
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
print("[✓] Done")
|
|
21
|
+
|
|
22
|
+
if isinstance(data, list):
|
|
23
|
+
for i, item in enumerate(data, 1):
|
|
24
|
+
pretty_print(item, title=f"{category} [{i}] -> {query}")
|
|
25
|
+
else:
|
|
26
|
+
pretty_print(data, title=f"Search: {category} -> {query}")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from gitraze.utils.helpers import pretty_print
|
|
2
|
+
from gitraze.modules.user import get_user_rest
|
|
3
|
+
|
|
4
|
+
def handle_user(args):
|
|
5
|
+
print("[+] Fetching user data...")
|
|
6
|
+
data = get_user_rest(args.username)
|
|
7
|
+
|
|
8
|
+
if "error" in data:
|
|
9
|
+
print(data["error"])
|
|
10
|
+
return
|
|
11
|
+
|
|
12
|
+
print("[✓] Done")
|
|
13
|
+
pretty_print(data, title=f"User: {args.username}")
|
|
File without changes
|
|
@@ -13,6 +13,11 @@ gitraze.egg-info/top_level.txt
|
|
|
13
13
|
gitraze/core/__init__.py
|
|
14
14
|
gitraze/core/api_graphql.py
|
|
15
15
|
gitraze/core/api_rest.py
|
|
16
|
+
gitraze/handlers/__init__.py
|
|
17
|
+
gitraze/handlers/analyze.py
|
|
18
|
+
gitraze/handlers/repo.py
|
|
19
|
+
gitraze/handlers/search.py
|
|
20
|
+
gitraze/handlers/user.py
|
|
16
21
|
gitraze/modules/__init__.py
|
|
17
22
|
gitraze/modules/analytics.py
|
|
18
23
|
gitraze/modules/repo.py
|
gitraze-0.2.3/gitraze/cli.py
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from gitraze.utils.helpers import pretty_print
|
|
3
|
-
from gitraze.modules.user import get_user_rest
|
|
4
|
-
from gitraze.modules.repo import get_repo_rest
|
|
5
|
-
from gitraze.modules.search import get_search_rest
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def main():
|
|
9
|
-
parser = argparse.ArgumentParser(
|
|
10
|
-
prog="gitraze",
|
|
11
|
-
description="GitRaze CLI Tool"
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
# Global flag
|
|
15
|
-
parser.add_argument(
|
|
16
|
-
"--version",
|
|
17
|
-
action="version",
|
|
18
|
-
version="gitraze 0.2.3"
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
22
|
-
|
|
23
|
-
# --- USER ---
|
|
24
|
-
user_parser = subparsers.add_parser("user", help="Fetch user info (GitHub username)")
|
|
25
|
-
user_parser.add_argument("username", help="Format: username")
|
|
26
|
-
|
|
27
|
-
# --- REPO ---
|
|
28
|
-
repo_parser = subparsers.add_parser("repo", help="Fetch repo info (Repository in owner/repo format)")
|
|
29
|
-
repo_parser.add_argument("repo", help="Format: owner/repo")
|
|
30
|
-
|
|
31
|
-
# --- SEARCH ---
|
|
32
|
-
search_parser = subparsers.add_parser("search", help="Search GitHub")
|
|
33
|
-
search_parser.add_argument("category",choices=["repos", "users", "issues", "prs", "topics"],help="repos | users | issues | prs | topics")
|
|
34
|
-
search_parser.add_argument("query", nargs="+", help="Search category (repos, users, issues, topics)")
|
|
35
|
-
search_parser.add_argument("-n", "--limit", type=int, default=1, help="Number of results to show")
|
|
36
|
-
|
|
37
|
-
# --- ANALYZE ---
|
|
38
|
-
analyze_parser = subparsers.add_parser("analyze", help="Analyze target")
|
|
39
|
-
analyze_parser.add_argument("target", nargs="+")
|
|
40
|
-
|
|
41
|
-
args = parser.parse_args()
|
|
42
|
-
|
|
43
|
-
# --- ROUTING ---
|
|
44
|
-
if args.command == "user":
|
|
45
|
-
handle_user(args)
|
|
46
|
-
elif args.command == "repo":
|
|
47
|
-
handle_repo(args)
|
|
48
|
-
elif args.command == "search":
|
|
49
|
-
handle_search(args)
|
|
50
|
-
elif args.command == "analyze":
|
|
51
|
-
handle_analysis(args)
|
|
52
|
-
else:
|
|
53
|
-
parser.print_help()
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# --- HANDLERS ---
|
|
57
|
-
|
|
58
|
-
def handle_user(args):
|
|
59
|
-
print("[+] Fetching user data...")
|
|
60
|
-
data = get_user_rest(args.username)
|
|
61
|
-
|
|
62
|
-
if "error" in data:
|
|
63
|
-
print(data["error"])
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
print("[✓] Done")
|
|
67
|
-
pretty_print(data, title=f"User: {args.username}")
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def handle_repo(args):
|
|
71
|
-
print("[+] Fetching repository data...")
|
|
72
|
-
parts = args.repo.split("/")
|
|
73
|
-
|
|
74
|
-
if len(parts) != 2:
|
|
75
|
-
print("Invalid format. Use: owner/repo")
|
|
76
|
-
return
|
|
77
|
-
owner, repo = parts
|
|
78
|
-
data = get_repo_rest(owner, repo)
|
|
79
|
-
|
|
80
|
-
if "error" in data:
|
|
81
|
-
print(data["error"])
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
print("[✓] Done")
|
|
85
|
-
pretty_print(data, title=f"User: {owner}, Repository: {repo}")
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def handle_search(args):
|
|
89
|
-
category = args.category
|
|
90
|
-
|
|
91
|
-
raw_query = " ".join(args.query)
|
|
92
|
-
clean_query = raw_query.replace('"', '')
|
|
93
|
-
query = f'"{clean_query}"'
|
|
94
|
-
|
|
95
|
-
print(f"[+] Searching {category} for {query}...")
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
data = get_search_rest(category, query, args.limit)
|
|
99
|
-
|
|
100
|
-
if "error" in data:
|
|
101
|
-
print(data["error"])
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
print("[✓] Done")
|
|
105
|
-
|
|
106
|
-
if isinstance(data, list):
|
|
107
|
-
for i, item in enumerate(data, 1):
|
|
108
|
-
pretty_print(item, title=f"{category} [{i}] -> {query}")
|
|
109
|
-
else:
|
|
110
|
-
pretty_print(data, title=f"Search: {category} -> {query}")
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def handle_analysis(args):
|
|
114
|
-
target = " ".join(args.target)
|
|
115
|
-
print(f"[ANALYZE] Analyzing '{target}'")
|
|
116
|
-
print("Not implemented yet")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|