fix: --plain should trim leading and trailing blank lines & v0.2.0

This commit is contained in:
2026-04-01 20:55:20 +02:00
parent 8af43ed112
commit 83c9553309
4 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -254,7 +254,7 @@ def to_plain(
prev_line = line prev_line = line
lines = deduped_lines lines = deduped_lines
return "\n".join(lines) return "\n".join(lines).strip("\n")
def print_lyrics( def print_lyrics(
+2 -5
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "lrx-cli" name = "lrx-cli"
version = "0.1.7" version = "0.2.0"
description = "Fetch line-synced lyrics for your music player." description = "Fetch line-synced lyrics for your music player."
readme = "README.md" readme = "README.md"
requires-python = ">=3.13" requires-python = ">=3.13"
@@ -25,7 +25,4 @@ lrx = "lrx_cli.cli:run"
ignore = ["E402"] ignore = ["E402"]
[dependency-groups] [dependency-groups]
dev = [ dev = ["pytest>=9.0.2", "ruff>=0.15.8"]
"pytest>=9.0.2",
"ruff>=0.15.8",
]
+8
View File
@@ -182,3 +182,11 @@ def test_to_plain_fallback_for_non_synced_text_strips_start_tags() -> None:
plain = to_plain(text) plain = to_plain(text)
assert plain == "only-zero\nplain line" assert plain == "only-zero\nplain line"
def test_to_plain_trims_leading_and_trailing_blank_lines() -> None:
text = "\n\n[00:01.00]line1\n\n[00:01.00]\n[00:02.00]line2\nline3\n\n"
plain = to_plain(text)
assert plain == "line1\n\nline2"
Generated
+1 -1
View File
@@ -153,7 +153,7 @@ wheels = [
[[package]] [[package]]
name = "lrx-cli" name = "lrx-cli"
version = "0.1.7" version = "0.2.0"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "cyclopts" }, { name = "cyclopts" },