Reference for llmcode/entrypoint.py
This module serves as the entry point for the LLMCode tool. It parses command-line arguments to determine the path to format, any directories or files to exclude, the programming languages to include, and the elements to document. It also handles the option to overwrite existing docstrings.
Options: path The path to the script or folder to be documented. --exclude Exclude specific files or folders from the path. --languages Specify programming languages to include. --elements2doc Specify elements to document. --overwrite Overwrite existing docstrings if present.
Author: Francisco Javier Gañán License File: https://github.com/javierganan99/LLMCode/blob/main/LICENSE
llmcode.entrypoint.parse_args
parse_args()
Parses command-line arguments for the script.
This function sets up an argument parser to handle the input parameters required for the script execution. It allows the user to specify a path, exclude certain files or directories, choose programming languages, identify elements to document, and decide whether to overwrite existing docstrings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The path to format without a name (default is None). |
required |
--exclude
|
str
|
A list of files or folders to exclude (default is exclude). |
required |
--languages
|
str
|
A list of programming languages to include (default is languages). |
required |
--elements2doc
|
str
|
A list of elements to document (default is elements2doc). |
required |
--overwrite
|
bool
|
Whether to overwrite the current docstrings (default is False). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Namespace |
An object containing the parsed arguments as attributes. |
Source code in llmcode/entrypoint.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
llmcode.entrypoint.main
main()
Main function to initiate the formatting process for scripts or folders.
This function sets up a signal handler for interrupt signals (SIGINT) to gracefully stop the operation
when requested. It checks for the required path argument, and if missing, logs an informative message
and exits. It then calls the format_code function with the appropriate parameters.
Source code in llmcode/entrypoint.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |