(manpage: ParsedManpage)
| 60 | |
| 61 | |
| 62 | def _estimate_manpage_size(manpage: ParsedManpage) -> int: |
| 63 | total = 256 |
| 64 | total += _estimate_text_size(manpage.source) |
| 65 | total += _estimate_text_size(manpage.name) |
| 66 | total += _estimate_text_size(manpage.synopsis) |
| 67 | total += _estimate_value_size(manpage.aliases) |
| 68 | total += _estimate_value_size(manpage.subcommands) |
| 69 | total += _estimate_value_size(manpage.nested_cmd) |
| 70 | total += _estimate_text_size(manpage.extractor) |
| 71 | if manpage.extraction_meta is not None: |
| 72 | total += _estimate_value_size(manpage.extraction_meta.model_dump()) |
| 73 | |
| 74 | for option in manpage.options: |
| 75 | total += 192 |
| 76 | total += _estimate_text_size(option.text) |
| 77 | total += _estimate_value_size(option.short) |
| 78 | total += _estimate_value_size(option.long) |
| 79 | total += _estimate_value_size(option.has_argument) |
| 80 | total += _estimate_value_size(option.positional) |
| 81 | total += _estimate_value_size(option.nested_cmd) |
| 82 | total += _estimate_value_size(option.meta) |
| 83 | |
| 84 | return total |
| 85 | |
| 86 | |
| 87 | def _estimate_cache_value_size(value: _CacheValue) -> int: |
no test coverage detected