Remove options with no flags and no positional name. Returns (filtered_list, num_removed).
(options: list[Option])
| 196 | |
| 197 | |
| 198 | def 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 | |
| 207 | def sanity_check_line_spans(options: list[Option]) -> None: |