Skip to content

Commit 14103fd

Browse files
committed
Fix default output file paths for covert commands
1 parent d580604 commit 14103fd

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/pygerber/console/gerber.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ def _get_raster_implementation_option(
9494
)
9595

9696

97-
def _get_output_file_option() -> Callable[[click.decorators.FC], click.decorators.FC]:
97+
def _get_output_file_option(
98+
default: str,
99+
) -> Callable[[click.decorators.FC], click.decorators.FC]:
98100
return click.option(
99101
"-o",
100102
"--output",
101103
type=click.Path(dir_okay=False),
102-
default="output.png",
104+
default=default,
103105
help="Path to output file.",
104106
)
105107

@@ -123,7 +125,7 @@ def _get_source_file_argument() -> Callable[[click.decorators.FC], click.decorat
123125

124126
@convert.command("png")
125127
@_get_source_file_argument()
126-
@_get_output_file_option()
128+
@_get_output_file_option("output.png")
127129
@_get_dpmm_option()
128130
@_get_file_type_option()
129131
@_get_style_option()
@@ -202,7 +204,7 @@ def _sanitize_style(
202204

203205
@convert.command("jpeg")
204206
@_get_source_file_argument()
205-
@_get_output_file_option()
207+
@_get_output_file_option("output.jpg")
206208
@_get_dpmm_option()
207209
@_get_file_type_option()
208210
@_get_style_option()
@@ -242,7 +244,7 @@ def jpeg( # noqa: PLR0913
242244

243245
@convert.command("tiff")
244246
@_get_source_file_argument()
245-
@_get_output_file_option()
247+
@_get_output_file_option("output.tiff")
246248
@_get_dpmm_option()
247249
@_get_file_type_option()
248250
@_get_style_option()
@@ -315,7 +317,7 @@ def tiff( # noqa: PLR0913
315317

316318
@convert.command("bmp")
317319
@_get_source_file_argument()
318-
@_get_output_file_option()
320+
@_get_output_file_option("output.bmp")
319321
@_get_dpmm_option()
320322
@_get_file_type_option()
321323
@_get_style_option()
@@ -347,7 +349,7 @@ def bmp(
347349

348350
@convert.command("webp")
349351
@_get_source_file_argument()
350-
@_get_output_file_option()
352+
@_get_output_file_option("output.webp")
351353
@_get_dpmm_option()
352354
@_get_file_type_option()
353355
@_get_style_option()
@@ -400,7 +402,7 @@ def webp( # noqa: PLR0913
400402

401403
@convert.command("svg")
402404
@_get_source_file_argument()
403-
@_get_output_file_option()
405+
@_get_output_file_option("output.svg")
404406
@_get_file_type_option()
405407
@_get_style_option()
406408
@_get_foreground_option()
@@ -508,7 +510,7 @@ def merge_convert() -> None:
508510

509511
@merge_convert.command("png")
510512
@click.argument("sources", nargs=-1)
511-
@_get_output_file_option()
513+
@_get_output_file_option("output.png")
512514
@_get_dpmm_option()
513515
@_get_file_type_option()
514516
@_get_raster_implementation_option("pillow")
@@ -542,7 +544,7 @@ def merge_convert_png(
542544

543545
@merge_convert.command("jpeg")
544546
@click.argument("sources", nargs=-1)
545-
@_get_output_file_option()
547+
@_get_output_file_option("output.jpg")
546548
@_get_dpmm_option()
547549
@_get_file_type_option()
548550
@_get_raster_implementation_option("pillow")

0 commit comments

Comments
 (0)