Create and return the argument parser for the CLI.
()
| 58 | |
| 59 | |
| 60 | def get_parser(): |
| 61 | """ |
| 62 | Create and return the argument parser for the CLI. |
| 63 | """ |
| 64 | parser = argparse.ArgumentParser( |
| 65 | description="Change extension of files in a working directory" |
| 66 | ) |
| 67 | parser.add_argument( |
| 68 | "work_dir", |
| 69 | help="The directory where to change extension", |
| 70 | ) |
| 71 | parser.add_argument( |
| 72 | "old_ext", help="Old extension (e.g., .txt or txt)" |
| 73 | ) |
| 74 | parser.add_argument( |
| 75 | "new_ext", help="New extension (e.g., .md or md)" |
| 76 | ) |
| 77 | parser.add_argument( |
| 78 | "--dry-run", |
| 79 | action="store_true", |
| 80 | help="Preview changes without applying them", |
| 81 | ) |
| 82 | return parser |
| 83 | |
| 84 | |
| 85 | def main(): |