|
@ -24,7 +24,7 @@ except ImportError: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repo_url = "https://api.github.com/repos/poikilos/EnlivenMinetest" |
|
|
repo_url = "https://api.github.com/repos/poikilos/EnlivenMinetest" |
|
|
url = repo_url + "/issues" |
|
|
issues_url = repo_url + "/issues" |
|
|
labels_url = repo_url + "/labels" |
|
|
labels_url = repo_url + "/labels" |
|
|
cmd = None |
|
|
cmd = None |
|
|
# me = sys.argv[0] |
|
|
# me = sys.argv[0] |
|
@ -44,12 +44,18 @@ cmds = { |
|
|
" issues)."), |
|
|
" issues)."), |
|
|
"examples": [" labels"] |
|
|
"examples": [" labels"] |
|
|
}, |
|
|
}, |
|
|
|
|
|
"page": { |
|
|
|
|
|
"help": ("GitHub only lists 30 issues at a time. Type page" |
|
|
|
|
|
" followed by a number to see additional pages."), |
|
|
|
|
|
"examples": [" page 2"] |
|
|
|
|
|
}, |
|
|
"<#>": { |
|
|
"<#>": { |
|
|
"help": "Specify an issue number to see details.", |
|
|
"help": "Specify an issue number to see details.", |
|
|
"examples": [" 1"] |
|
|
"examples": [" 1"] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
match_all_labels = [] |
|
|
match_all_labels = [] |
|
|
|
|
|
page = None |
|
|
def usage(): |
|
|
def usage(): |
|
|
print("") |
|
|
print("") |
|
|
print("Commands:") |
|
|
print("Commands:") |
|
@ -65,17 +71,24 @@ def usage(): |
|
|
print(" "*(left_w+len(spacer)+2) + "./" + me + s) |
|
|
print(" "*(left_w+len(spacer)+2) + "./" + me + s) |
|
|
print("") |
|
|
print("") |
|
|
print("") |
|
|
print("") |
|
|
|
|
|
|
|
|
match_number = None |
|
|
match_number = None |
|
|
for i in range(1, len(sys.argv)): |
|
|
for i in range(1, len(sys.argv)): |
|
|
arg = sys.argv[i] |
|
|
arg = sys.argv[i] |
|
|
if arg.startswith("#"): |
|
|
if arg.startswith("#"): |
|
|
arg = arg[1:] |
|
|
arg = arg[1:] |
|
|
if (cmd is None) and (arg in cmds.keys()): |
|
|
if (cmd is None) and (arg in cmds.keys()): |
|
|
cmd = arg |
|
|
if arg == "page": |
|
|
print("* mode set to {}".format(cmd)) |
|
|
cmd = "list" |
|
|
|
|
|
else: |
|
|
|
|
|
cmd = arg |
|
|
else: |
|
|
else: |
|
|
try: |
|
|
try: |
|
|
match_number = int(arg) |
|
|
i = int(arg) |
|
|
|
|
|
if cmd == "list": |
|
|
|
|
|
page = i |
|
|
|
|
|
else: |
|
|
|
|
|
match_number = i |
|
|
except ValueError: |
|
|
except ValueError: |
|
|
if (cmd is None) and (cmds.get(arg) is not None): |
|
|
if (cmd is None) and (cmds.get(arg) is not None): |
|
|
cmd = arg |
|
|
cmd = arg |
|
@ -108,7 +121,10 @@ elif cmd not in valid_cmds: |
|
|
exit(0) |
|
|
exit(0) |
|
|
print("") |
|
|
print("") |
|
|
# print("Loading...") |
|
|
# print("Loading...") |
|
|
response = request.urlopen(url) |
|
|
query_s = issues_url |
|
|
|
|
|
if page is not None: |
|
|
|
|
|
query_s = issues_url + "?page=" + str(page) |
|
|
|
|
|
response = request.urlopen(query_s) |
|
|
d_s = response.read() |
|
|
d_s = response.read() |
|
|
d = json.loads(d_s) |
|
|
d = json.loads(d_s) |
|
|
label_ids = [] |
|
|
label_ids = [] |
|
@ -147,7 +163,7 @@ for issue in d: |
|
|
if this_issue_match_count == len(match_all_labels): |
|
|
if this_issue_match_count == len(match_all_labels): |
|
|
match_count += 1 |
|
|
match_count += 1 |
|
|
print("#{} {}".format(issue["number"], issue["title"])) |
|
|
print("#{} {}".format(issue["number"], issue["title"])) |
|
|
elif match_number is None: |
|
|
elif (match_number is None) and (cmd == "list"): |
|
|
# Show all since no criteria is set. |
|
|
# Show all since no criteria is set. |
|
|
match_count += 1 |
|
|
match_count += 1 |
|
|
print("#{} {}".format(issue["number"], issue["title"])) |
|
|
print("#{} {}".format(issue["number"], issue["title"])) |
|
@ -203,6 +219,8 @@ if matching_issue is not None: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if cmd == "labels": |
|
|
if cmd == "labels": |
|
|
|
|
|
# print("Labels:") |
|
|
|
|
|
# print("") |
|
|
for label_s in labels: |
|
|
for label_s in labels: |
|
|
print(label_s) |
|
|
print(label_s) |
|
|
print("") |
|
|
print("") |
|
@ -215,7 +233,19 @@ elif cmd == "list": |
|
|
" + ".join("'{}'".format(s) for s in match_all_labels) |
|
|
" + ".join("'{}'".format(s) for s in match_all_labels) |
|
|
)) |
|
|
)) |
|
|
else: |
|
|
else: |
|
|
print("{} issue(s) are showing.".format(match_count)) |
|
|
if page is not None: |
|
|
|
|
|
print("{} issue(s) are showing for page" |
|
|
|
|
|
" {}.".format(match_count, page)) |
|
|
|
|
|
else: |
|
|
|
|
|
print("{} issue(s) are showing.".format(match_count)) |
|
|
|
|
|
if match_count >= 30: |
|
|
|
|
|
print("That is the maximum number per page. Type") |
|
|
|
|
|
if page is not None: |
|
|
|
|
|
print(" ./" + me + " page " + str(page+1)) |
|
|
|
|
|
print("to see additional pages.") |
|
|
|
|
|
else: |
|
|
|
|
|
print(" ./" + me + " page") |
|
|
|
|
|
print("followed by a number to see additional pages.") |
|
|
if match_count > 0: |
|
|
if match_count > 0: |
|
|
print() |
|
|
print() |
|
|
print() |
|
|
print() |
|
|