Repository navigation
fix(cli): wait for test jobs and print only the requested lines #1528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: beta
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,17 +138,15 @@ def read(path: str, start_line: Optional[int], line_count: Optional[int]): | |
| "path": directory, | ||
| } | ||
|
|
||
| if start_line: | ||
| params["startLine"] = start_line | ||
| if line_count: | ||
| params["lineCount"] = line_count | ||
|
|
||
| result = run_command("manage_script", params, config) | ||
| # For read, output content directly if available | ||
| if result.get("success") and result.get("data"): | ||
| data = result.get("data", {}) | ||
| if isinstance(data, dict) and "contents" in data: | ||
| click.echo(data["contents"]) | ||
| # Unity returns the whole file, so the range is cut here | ||
| first = (start_line or 1) - 1 | ||
| lines = data["contents"].splitlines(keepends=True) | ||
| click.echo("".join(lines[first:first + line_count if line_count else None])) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Distinguish zero lines from an omitted line count. With
|
||
| else: | ||
| click.echo(format_output(result, config.format)) | ||
| else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -115,17 +115,15 @@ def read(path: str, start_line: Optional[int], line_count: Optional[int]): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "path": directory, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if start_line: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params["startLine"] = start_line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if line_count: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params["lineCount"] = line_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = run_command("manage_script", params, config) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # For read, just output the content directly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if result.get("success") and result.get("data"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data = result.get("data", {}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if isinstance(data, dict) and "contents" in data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| click.echo(data["contents"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Unity returns the whole file, so the range is cut here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| first = (start_line or 1) - 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lines = data["contents"].splitlines(keepends=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| click.echo("".join(lines[first:first + line_count if line_count else None])) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| click.echo(format_output(result, config.format)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
115
to
129
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unwrap the If Unity's reply reaches the CLI as Suggested fix
Committable suggestion
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code readnever applies the line range when Unity's response is nested.run_commandreturns the server response unchanged.readcheckssuccessonly at the top level. The repository'ssearchcommand, which reads the samemanage_scriptresponse, documents that the server can return the nested shape{status, result: {success, data}}. For that shape,code readfalls through to the full-response output. With--start-line 2 --line-count 1, the command prints the whole file instead of the requested line.Unwrap the response the same way
searchdoes before the success check:Suggested fix