fix: --plain should trim leading and trailing blank lines & v0.2.0
This commit is contained in:
+1
-1
@@ -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
@@ -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",
|
|
||||||
]
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user