aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2015-12-09 23:06:21 +0100
committerVictor Häggqvist <[email protected]>2015-12-09 23:06:21 +0100
commitdfcdca379234a648f277d70aa0cc98d5b84b5645 (patch)
treed02433810d07eefdd2103fdfc4958295618da641
parenteb66398e806d2204b5181ca837527ffb8eb46dc9 (diff)
check search results with ignored case
-rwxr-xr-xgiti7
1 files changed, 7 insertions, 0 deletions
diff --git a/giti b/giti
index 4f3cdae..819d2f7 100755
--- a/giti
+++ b/giti
@@ -43,6 +43,13 @@ def search_for_file(kind: str) -> str:
r = requests.get('https://api.github.com/search/code?q=repo:github/gitignore %s' % kind, headers=headers)
cont = r.json()
+ # Check is any result match when ignoring case
+ for i in range(0, len(cont['items'])):
+ name = cont['items'][i]['name'].split('.')[0]
+ if name.lower() == kind.lower():
+ print("Found match {}".format(name))
+ return cont['items'][i]['path']
+
print('One of these might be good:')
for i in range(0, len(cont['items'])):
name = cont['items'][i]['name'].split('.')[0]