enrich command matches with links to other man pages with the same name
(matches, command)
| 1 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected