Skip to content

Commit 3ceee51

Browse files
committed
github.py: make it executable from the CLI
Pass the query as argument(s).
1 parent d3d204a commit 3ceee51

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

github.py

100644100755
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# ------------------------------------------------------------------------
99
# A class to download and organize information from GitHub.
1010

11-
import json, logging, math
11+
import json, logging, math, sys
1212
import requests
1313

1414
class GitHubIssues:
@@ -72,3 +72,13 @@ def _merge(self, content):
7272
else:
7373
# Overwrite value in the dict.
7474
self._json[key] = value
75+
76+
if __name__ == '__main__':
77+
if len(sys.argv) < 2:
78+
print("Usage: github.py <query>")
79+
print("Ex: github.py repo:scijava/pom-scijava")
80+
sys.exit(1)
81+
query = "+".join(sys.argv[1:])
82+
ghi = GitHubIssues()
83+
ghi.download(query)
84+
print(json.dumps(ghi._json, sort_keys=True, indent=4))

0 commit comments

Comments
 (0)