MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / create_parser

Function create_parser

plain2code_arguments.py:164–371  ·  view source on GitHub ↗

Create the argument parser without parsing arguments.

()

Source from the content-addressed store, hash-verified

162
163
164def create_parser():
165 """Create the argument parser without parsing arguments."""
166 parser_kwargs: dict[str, Any] = {
167 "description": "Render plain code to target code.",
168 }
169
170 parser = argparse.ArgumentParser(**parser_kwargs)
171
172 parser.add_argument(
173 "filename",
174 type=str,
175 nargs="?",
176 help="Path to the plain file to render. The directory containing this file has highest precedence for template loading, "
177 "so you can place custom templates here to override the defaults. See --template-dir for more details about template loading.",
178 )
179 parser.add_argument(
180 "--verbose",
181 "-v",
182 action="store_true",
183 default=False,
184 help="Set default log level to DEBUG for TUI and file logs",
185 )
186 parser.add_argument("--base-folder", type=str, help="Base folder for the build files")
187 parser.add_argument(
188 "--build-folder", type=non_empty_string, default=DEFAULT_BUILD_FOLDER, help="Folder for build files"
189 )
190
191 parser.add_argument(
192 "--log-to-file",
193 action=argparse.BooleanOptionalAction,
194 default=True,
195 help="Enable logging to a file. Defaults to True. Set to False to disable.",
196 )
197 parser.add_argument(
198 "--log-file-name",
199 type=str,
200 default=DEFAULT_LOG_FILE_NAME,
201 help=f"Name of the log file. Defaults to '{DEFAULT_LOG_FILE_NAME}'."
202 "Always resolved relative to the plain file directory."
203 "If file on this path already exists, the already existing log file will be overwritten by the current logs.",
204 )
205
206 # Add config file arguments
207 config_group = parser.add_argument_group("configuration")
208 config_group.add_argument(
209 "--config-name",
210 type=non_empty_string,
211 default="config.yaml",
212 help="Name of the config file to look for. Looked up in the plain file directory and the current working directory. Defaults to config.yaml.",
213 )
214
215 render_range_group = parser.add_mutually_exclusive_group()
216 render_range_group.add_argument(
217 "--render-range",
218 type=frid_range_string,
219 help="Specify a range of functionalities to render (e.g. `1` , `2`, `3`). "
220 "Use comma to separate start and end IDs. If only one functionality ID is provided, only that functionality is rendered. "
221 "Range is inclusive of both start and end IDs.",

Callers 2

mainFunction · 0.90
parse_argumentsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected