@@ -172,39 +172,43 @@ def cli() -> None:
172172 """Parse arguments and call the conversion function."""
173173 parser = argparse .ArgumentParser (
174174 description = textwrap .dedent ("""
175- Convert pyright.json to GitLab Code Quality report.
176- By default, reads from stdin and writes to stdout.""" ),
175+ Convert Pyright JSON output to a GitLab Code Quality report.
176+
177+ Input defaults to stdin and output defaults to stdout.
178+ Use '-' explicitly for stdin/stdout when mixing with file paths.""" ),
177179 epilog = textwrap .dedent (
178180 """
179- # Example usage:
180- > pyright . --outputjson | pyright-to-gitlab > gitlab_code_quality.json
181- > pyright-to-gitlab -i pyright.json -o gitlab_code_quality.json
181+ Examples:
182+ pyright . --outputjson | pyright-to-gitlab > gl-code-quality.json
183+ pyright-to-gitlab -i pyright.json -o gl-code-quality.json
184+ pyright-to-gitlab --prefix backend/ -i pyright.json -o -
185+ pyright-to-gitlab -i pyright.json --indent 0
182186 """
183187 ),
184- formatter_class = argparse .RawDescriptionHelpFormatter ,
188+ formatter_class = argparse .RawTextHelpFormatter ,
185189 )
186190 parser .add_argument (
187191 "-i" ,
188192 "--input" ,
189193 type = str ,
190- metavar = "PYRIGHT_FILE " ,
194+ metavar = "INPUT " ,
191195 default = "-" ,
192- help = "Input file path (default: -). Use '-' to read from stdin." ,
196+ help = "Path to Pyright JSON input (default: -). Use - to read from stdin." ,
193197 )
194198 parser .add_argument (
195199 "-o" ,
196200 "--output" ,
197201 type = str ,
198202 default = "-" ,
199- metavar = "GITLAB_CODE_QUALITY_FILE " ,
200- help = "Output file path (default: '-' ). Use '-' to write to stdout."
203+ metavar = "OUTPUT " ,
204+ help = "Path for GitLab Code Quality JSON (default: - ). Use - to write to stdout." ,
201205 )
202206 parser .add_argument (
203207 "--prefix" ,
204208 type = str ,
209+ metavar = "PATH_PREFIX" ,
205210 default = "" ,
206- help = "Prefix path to add to each file entry. This can be used if pyright is run"
207- " from a subdirectory of the repository. (default: empty string)" ,
211+ help = "Prefix added to each reported file path, e.g. 'backend/' for monorepos." ,
208212 )
209213 parser .add_argument ("--version" , action = "version" , version = f"%(prog)s { VERSION } " )
210214 args = parser .parse_args ()
0 commit comments