Parse the command line. Return: The parsed command line.
()
| 176 | |
| 177 | |
| 178 | def parse_command_line() -> argparse.Namespace: |
| 179 | ''' |
| 180 | Parse the command line. |
| 181 | |
| 182 | Return: |
| 183 | The parsed command line. |
| 184 | ''' |
| 185 | parser = argparse.ArgumentParser() |
| 186 | |
| 187 | parser.add_argument('img', type=argparse.FileType('r'), |
| 188 | help='the image file to compress') |
| 189 | |
| 190 | encoders = ['sse2', 'sse4.1', 'avx2'] |
| 191 | parser.add_argument('--encoder', dest='encoder', default='avx2', |
| 192 | choices=encoders, |
| 193 | help='the encoder variant to profile') |
| 194 | |
| 195 | testquant = [str(x) for x in range(0, 101, 10)] |
| 196 | testqual = ['-fastest', '-fast', '-medium', '-thorough', '-exhaustive'] |
| 197 | qualities = testqual + testquant |
| 198 | parser.add_argument('--test-quality', dest='quality', default='medium', |
| 199 | choices=qualities, |
| 200 | help='the compression quality to profile') |
| 201 | |
| 202 | parser.add_argument('--show-cli', dest='show_cli', default=False, |
| 203 | action='store_true', |
| 204 | help='enable CLI wrapper nodes in call graph') |
| 205 | |
| 206 | args = parser.parse_args() |
| 207 | |
| 208 | return args |
| 209 | |
| 210 | |
| 211 | def main() -> int: |