From dfcdca379234a648f277d70aa0cc98d5b84b5645 Mon Sep 17 00:00:00 2001 From: Victor Häggqvist Date: Wed, 9 Dec 2015 23:06:21 +0100 Subject: check search results with ignored case --- giti | 7 +++++++ 1 file changed, 7 insertions(+) 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] -- cgit v1.2.3