()
| 195 | print(' merely indicate which files need formatting') |
| 196 | |
| 197 | def Main(): |
| 198 | if len(sys.argv) < 3: |
| 199 | print("error: at least 2 arguments required") |
| 200 | print_usage(); |
| 201 | sys.exit(-1) |
| 202 | |
| 203 | def is_option(arg): |
| 204 | return arg in ['-i', '-l', '-il'] |
| 205 | |
| 206 | should_format = lint = False |
| 207 | |
| 208 | flag, files = sys.argv[1], sys.argv[2:] |
| 209 | if is_option(flag): |
| 210 | if '-i' == flag: |
| 211 | should_format = True |
| 212 | elif '-l' == flag: |
| 213 | lint = True |
| 214 | else: |
| 215 | lint = True |
| 216 | should_format = True |
| 217 | else: |
| 218 | print("error: -i and/or -l flags must be specified") |
| 219 | print_usage(); |
| 220 | sys.exit(-1); |
| 221 | |
| 222 | for filename in files: |
| 223 | process(filename, lint, should_format) |
| 224 | |
| 225 | return 0 |
| 226 | |
| 227 | if __name__ == '__main__': |
| 228 | sys.exit(Main()); |
no test coverage detected