MCPcopy Create free account
hub / github.com/geekcomputers/Python / get_parser

Function get_parser

batch_file_rename.py:60–82  ·  view source on GitHub ↗

Create and return the argument parser for the CLI.

()

Source from the content-addressed store, hash-verified

58
59
60def 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
85def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected