MCPcopy Create free account
hub / github.com/idank/explainshell / suggestions

Function suggestions

explainshell/web/helpers.py:1–17  ·  view source on GitHub ↗

enrich command matches with links to other man pages with the same name

(matches, command)

Source from the content-addressed store, hash-verified

1def suggestions(matches, command):
2 """enrich command matches with links to other man pages with the
3 same name"""
4 for m in matches:
5 if "name" in m and "suggestions" in m:
6 before = command[: m["start"]]
7 after = command[m["end"] :]
8 new_suggestions = []
9 for other_mp in sorted(m["suggestions"], key=lambda mp: mp.section):
10 mid = f"{other_mp.name}.{other_mp.section}"
11 new_suggestions.append(
12 {
13 "cmd": "".join([before, mid, after]),
14 "text": other_mp.name_section,
15 }
16 )
17 m["suggestions"] = new_suggestions

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected