MCPcopy Create free account
hub / github.com/chubin/cheat.sh / _answer_add_comments

Function _answer_add_comments

lib/postprocessing.py:13–33  ·  view source on GitHub ↗
(answer, request_options=None)

Source from the content-addressed store, hash-verified

11
12
13def _answer_add_comments(answer, request_options=None):
14
15 if answer["format"] != "text+code":
16 return answer
17
18 topic = answer["topic"]
19 if "filetype" in answer:
20 filetype = answer["filetype"]
21 else:
22 filetype = "bash"
23 if "/" in topic:
24 filetype = topic.split("/", 1)[0]
25 if filetype.startswith("q:"):
26 filetype = filetype[2:]
27
28 answer["answer"] = fmt.comments.beautify(
29 answer["answer"], filetype, request_options
30 )
31 answer["format"] = "code"
32 answer["filetype"] = filetype
33 return answer
34
35
36def _answer_filter_by_keyword(answer, keyword, options, request_options=None):

Callers 1

postprocessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected