Skip to content

Commit b9b77ec

Browse files
Lucas-CCimon Lucas (LCM)
and
Cimon Lucas (LCM)
authored
Fix #60 - Prettier command help formatting (#62)
Co-authored-by: Cimon Lucas (LCM) <[email protected]>
1 parent 2acb632 commit b9b77ec

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

pdfly/cli.py

+8-16
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def version_callback(value: bool) -> None:
3333
help=(
3434
"pdfly is a pure-python cli application for manipulating PDF files."
3535
),
36+
rich_markup_mode="rich", # Allows to pretty-print commands documentation
3637
)
3738

3839

@@ -44,7 +45,7 @@ def common(
4445
pass
4546

4647

47-
@entry_point.command(name="extract-images") # type: ignore[misc]
48+
@entry_point.command(name="extract-images", help=pdfly.extract_images.__doc__) # type: ignore[misc]
4849
def extract_images(
4950
pdf: Annotated[
5051
Path,
@@ -61,7 +62,7 @@ def extract_images(
6162
pdfly.extract_images.main(pdf)
6263

6364

64-
@entry_point.command(name="2-up") # type: ignore[misc]
65+
@entry_point.command(name="2-up", help=pdfly.up2.__doc__) # type: ignore[misc]
6566
def up2(
6667
pdf: Annotated[
6768
Path,
@@ -79,7 +80,7 @@ def up2(
7980
pdfly.up2.main(pdf, out)
8081

8182

82-
@entry_point.command(name="cat") # type: ignore[misc]
83+
@entry_point.command(name="cat", help=pdfly.cat.__doc__) # type: ignore[misc]
8384
def cat(
8485
filename: Annotated[
8586
Path,
@@ -103,7 +104,7 @@ def cat(
103104
pdfly.cat.main(filename, fn_pgrgs, output, verbose)
104105

105106

106-
@entry_point.command(name="meta") # type: ignore[misc]
107+
@entry_point.command(name="meta", help=pdfly.metadata.__doc__) # type: ignore[misc]
107108
def metadata(
108109
pdf: Annotated[
109110
Path,
@@ -127,7 +128,7 @@ def metadata(
127128
pdfly.metadata.main(pdf, output)
128129

129130

130-
@entry_point.command(name="pagemeta") # type: ignore[misc]
131+
@entry_point.command(name="pagemeta", help=pdfly.pagemeta.__doc__) # type: ignore[misc]
131132
def pagemeta(
132133
pdf: Annotated[
133134
Path,
@@ -178,7 +179,7 @@ def extract_text(
178179
print(page.extract_text())
179180

180181

181-
@entry_point.command(name="compress") # type: ignore[misc]
182+
@entry_point.command(name="compress", help=pdfly.compress.__doc__) # type: ignore[misc]
182183
def compress(
183184
pdf: Annotated[
184185
Path,
@@ -202,7 +203,7 @@ def compress(
202203
pdfly.compress.main(pdf, output)
203204

204205

205-
@entry_point.command(name="x2pdf") # type: ignore[misc]
206+
@entry_point.command(name="x2pdf", help=pdfly.x2pdf.__doc__) # type: ignore[misc]
206207
def x2pdf(
207208
x: List[Path],
208209
output: Annotated[
@@ -216,12 +217,3 @@ def x2pdf(
216217
],
217218
) -> int:
218219
return pdfly.x2pdf.main(x, output)
219-
220-
221-
up2.__doc__ = pdfly.up2.__doc__
222-
extract_images.__doc__ = pdfly.extract_images.__doc__
223-
cat.__doc__ = pdfly.cat.__doc__
224-
metadata.__doc__ = pdfly.metadata.__doc__
225-
pagemeta.__doc__ = pdfly.pagemeta.__doc__
226-
compress.__doc__ = pdfly.compress.__doc__
227-
x2pdf.__doc__ = pdfly.x2pdf.__doc__

0 commit comments

Comments
 (0)