()
| 19 | |
| 20 | |
| 21 | def main(): |
| 22 | parser = argparse.ArgumentParser( |
| 23 | "TextAttack CLI", |
| 24 | usage="[python -m] textattack <command> [<args>]", |
| 25 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, |
| 26 | ) |
| 27 | subparsers = parser.add_subparsers(help="textattack command helpers") |
| 28 | |
| 29 | # Register commands |
| 30 | AttackCommand.register_subcommand(subparsers) |
| 31 | AttackResumeCommand.register_subcommand(subparsers) |
| 32 | AugmentCommand.register_subcommand(subparsers) |
| 33 | BenchmarkRecipeCommand.register_subcommand(subparsers) |
| 34 | EvalModelCommand.register_subcommand(subparsers) |
| 35 | ListThingsCommand.register_subcommand(subparsers) |
| 36 | TrainModelCommand.register_subcommand(subparsers) |
| 37 | PeekDatasetCommand.register_subcommand(subparsers) |
| 38 | |
| 39 | # Let's go |
| 40 | args = parser.parse_args() |
| 41 | |
| 42 | if not hasattr(args, "func"): |
| 43 | parser.print_help() |
| 44 | exit(1) |
| 45 | |
| 46 | # Run |
| 47 | func = args.func |
| 48 | del args.func |
| 49 | func.run(args) |
| 50 | |
| 51 | |
| 52 | if __name__ == "__main__": |
no test coverage detected