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

Function drop_empty

explainshell/extraction/postprocess.py:198–204  ·  view source on GitHub ↗

Remove options with no flags and no positional name. Returns (filtered_list, num_removed).

(options: list[Option])

Source from the content-addressed store, hash-verified

196
197
198def drop_empty(options: list[Option]) -> tuple[list[Option], int]:
199 """Remove options with no flags and no positional name.
200
201 Returns (filtered_list, num_removed).
202 """
203 kept = [opt for opt in options if opt.short or opt.long or opt.positional]
204 return kept, len(options) - len(kept)
205
206
207def sanity_check_line_spans(options: list[Option]) -> None:

Callers 1

postprocessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected