Skip to content

Commit

Permalink
feat: use default if passed search engine not in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
alastairhm committed Aug 10, 2022
1 parent 080fefa commit d5e493e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion search.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ def __init__(self, engine='default'):
"""Init"""
script_path = os.path.dirname(os.path.abspath(__file__))
self.settings = toml.load(os.path.join(script_path, "searchIt.toml"))
self.default_url = self.settings[self.settings['default']]

if engine == 'default':
self.engine = self.settings[engine]
else:
self.engine = engine
self.search_url = self.settings[self.engine]
self.search_url = self.settings.get(self.engine, self.default_url)

def search(self, term=pyperclip.paste()):
"""Search"""
Expand Down
2 changes: 1 addition & 1 deletion searchIt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ default = "duckduck"
bing = "https://bing.com/search?q="
duckduck = "https://duckduckgo.com/?q="
google = "https://www.google.com/search?q="
maps = "https://www.google.com/maps/place/"
gmaps = "https://www.google.com/maps/place/"
startpage = "https://www.startpage.com/sp/search?q="

0 comments on commit d5e493e

Please sign in to comment.