Repository navigation
Remove source-code indentation from multi-line terminal messages - #124
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #123.
Changes
No more source-code indentation. 10 multi-line terminal messages were written as
dedent(f"""\033[31m ....dedent()only removes indentation that every line shares, and the first line (the color code) had none, so every line kept up to 24 spaces of indentation. Each message now dedents plain text and adds the color codes around the result:The colors don't change: red for errors and warnings, yellow for the update notice. The messages are in
twopass.py(FFmpeg failure, HDR, "Time Paradox?", output extension, framerate, aspect ratio),__main__.py(retry "Restarting...", update notice),arguments.py(invalid--astreams), andwindows.py(not-Windows warning).FFmpeg failure hint. The hardware-encoder hint used to be a separate red block glued to the end of the message. It's now its own paragraph inside the same red text.
"Time Paradox?" video length. It now shows the length as a timestamp, like the clip times on the next line: "Your video is 00:00:54.747 long" instead of "0.9124507000000001 minutes".
Typo. "croped" is now "cropped" in the aspect-ratio warning.
Since
.strip()removes the leading newline, each message now starts on the same line asERROR:root:orWARNING:root:instead of on the line after it.Testing
uv run pytest --cov: 286 passed, 99% coverage.ruff formatandruff checkare clean.ValueErrorhas no line starting with a space, and shows "Your video is 00:02:00 long" for the 120-second test video.example.mp4(trimmed to 10 seconds), with the color codes shown bycat -v: "Time Paradox?", invalid--astreams, the output extension, framerate, and aspect-ratio warnings, theh264_nvencfailure with its hint, and thewindows.pywarning on macOS all start at the left edge and are red from start to end. The retry message and the update notice weren't triggered: they need an oversized output and a newer PyPI release.