Rename the gus command to search, and the old search to filter. Add option to set search endpoint.
This commit is contained in:
parent
0268cd426b
commit
0e91b4f894
|
@ -67,7 +67,7 @@ _ABBREVS = {
|
|||
"r": "reload",
|
||||
"s": "save",
|
||||
"se": "search",
|
||||
"/": "search",
|
||||
"/": "filter",
|
||||
"t": "tour",
|
||||
"u": "up",
|
||||
}
|
||||
|
@ -246,7 +246,8 @@ class GeminiClient(cmd.Cmd):
|
|||
"tls_mode" : "tofu",
|
||||
"gopher_proxy" : None,
|
||||
"http_proxy": None,
|
||||
"cache" : False
|
||||
"cache" : False,
|
||||
"search_url" : "gemini://geminispace.info/search"
|
||||
}
|
||||
|
||||
self.log = {
|
||||
|
@ -901,7 +902,7 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
|||
elif line.strip() == "..":
|
||||
return self.do_up()
|
||||
elif line.startswith("/"):
|
||||
return self.do_search(line[1:])
|
||||
return self.do_filter(line[1:])
|
||||
|
||||
# Expand abbreviated commands
|
||||
first_word = line.split()[0].strip()
|
||||
|
@ -1074,8 +1075,13 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
|
|||
|
||||
def do_gus(self, line):
|
||||
"""Submit a search query to the Gemini search engine."""
|
||||
gus = GeminiItem("gemini://geminispace.info/search")
|
||||
self._go_to_gi(gus.query(line))
|
||||
ui_out.warning("[WARNING] The `gus` command is deprecated! Use `search` instead.")
|
||||
self.do_search(line)
|
||||
|
||||
def do_search(self, line):
|
||||
"""Submit a search query a configured Gemini search engine."""
|
||||
gi = GeminiItem(self.options["search_url"])
|
||||
self._go_to_gi(gi.query(line))
|
||||
|
||||
def do_tour(self, line):
|
||||
"""Add index items as waypoints on a tour, which is basically a FIFO
|
||||
|
@ -1159,8 +1165,8 @@ Use 'ls -l' to see URLs."""
|
|||
self._show_lookup(url=True)
|
||||
self.page_index = 0
|
||||
|
||||
def do_search(self, searchterm):
|
||||
"""Search index (case insensitive)."""
|
||||
def do_filter(self, searchterm):
|
||||
"""Filter index on names (case insensitive)."""
|
||||
results = [
|
||||
gi for gi in self.lookup if searchterm.lower() in gi.name.lower()]
|
||||
if results:
|
||||
|
|
Loading…
Reference in New Issue