MCPcopy Index your code
hub / github.com/idank/explainshell / manpage_list

Function manpage_list

explainshell/web/views.py:122–147  ·  view source on GitHub ↗

List available manpages within a section.

(distro, release, section)

Source from the content-addressed store, hash-verified

120
121@debug_bp.route("/manpage/<distro>/<release>/<section>/")
122def manpage_list(distro, release, section):
123 """List available manpages within a section."""
124 prefix = f"{distro}/{release}/{section}/"
125 sources = get_store().list_manpages(prefix)
126 entries = []
127 for source in sorted(sources):
128 # source is e.g. "ubuntu/26.04/1/cd.1posix.gz"; strip the
129 # distro/release prefix and .gz suffix to form the URL tail.
130 tail = source[len(f"{distro}/{release}/") : -3] # "1/cd.1posix"
131 basename = os.path.basename(source)[:-3]
132 name, sec = util.name_section(basename)
133 entries.append(
134 {
135 "name": name,
136 "section": sec,
137 "url": f"/manpage/{distro}/{release}/{urllib.parse.quote(tail)}",
138 }
139 )
140
141 return render_template(
142 "manpage_list.html",
143 distro=distro,
144 release=release,
145 section=section,
146 entries=entries,
147 )
148
149
150@debug_bp.route("/manpage/<distro>/<release>/<path:rest>")

Callers

nothing calls this directly

Calls 3

get_storeFunction · 0.90
list_manpagesMethod · 0.80
name_sectionMethod · 0.80

Tested by

no test coverage detected