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

Method visitredirect

explainshell/matcher.py:230–258  ·  view source on GitHub ↗
(self, node, input, r_type, output, heredoc)

Source from the content-addressed store, hash-verified

228 )
229
230 def visitredirect(self, node, input, r_type, output, heredoc):
231 helptext = [help_constants.REDIRECTION]
232
233 if r_type == ">&" and isinstance(output, int):
234 r_type = r_type[:-1]
235
236 if r_type in help_constants.REDIRECTION_KIND:
237 helptext.append(help_constants.REDIRECTION_KIND[r_type])
238
239 logger.debug(helptext)
240
241 self.groups[0].results.append(
242 MatchResult(
243 node.pos[0],
244 node.pos[1],
245 "\n\n".join(helptext),
246 None,
247 {"kind": "redirect"},
248 )
249 )
250
251 # the output might contain a wordnode, visiting it will confuse the
252 # matcher who'll think it's an argument, instead visit the expansions
253 # directly, if we have any
254 if isinstance(output, bashlex.ast.node):
255 for part in output.parts:
256 self.visit(part)
257
258 return False
259
260 def visitcommand(self, node, parts):
261 assert parts

Callers

nothing calls this directly

Calls 1

MatchResultClass · 0.85

Tested by

no test coverage detected