Reject unsupported output extensions - #115
Merged
Merged
Conversation
Psy-Fer
reviewed
Aug 5, 2026
|
|
||
| ### Fixed | ||
|
|
||
| - **CLI output extensions now select formats case-insensitively and reject unsupported paths:** `-o plot.PNG` and `-o plot.PdF` now use their intended backends, while unknown or missing extensions return an error instead of silently writing SVG content under a misleading file name. |
Owner
There was a problem hiding this comment.
I would probably move this under a ### Changed heading rather than fixed, as it causes a break in expectation for someone writing to a output.dat and expecting svg or whatever.
Psy-Fer
approved these changes
Aug 5, 2026
Psy-Fer
left a comment
Owner
There was a problem hiding this comment.
This is great, and I agree with strict enforcement. Doc changes are good too, just the one thing for the CHANGELOG moving it to a ### Changed subheading over fixed
Owner
|
Which I fixed doing the merge conflict :) |
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.
Hello there,
I wanted to open this PR because I realized that the output filename can currently conflict with the content Kuva writes. For example,
-o plot.pgn, an output path without an extension, and even-o plot.PNGall succeed but contain SVG. The first two can hide a typo, while the last one looks like a PNG but isn't one.I changed the CLI so
.svg,.png, and.pdfare recognized case-insensitively. Other or missing extensions now return an error during argument parsing, before Kuva reads the input or renders anything, and no misleading output file is created.What I changed:
I kept the scope limited to CLI file output through
-o/--output. SVG on stdout is unchanged, supported lowercase paths behave as before, and PNG/PDF still require their existing features. This does not add a--formatflag or change the library backend APIs, terminal output, input handling, or rendering itself.For testing, I first ran the new behaviour tests against the unchanged
devimplementation and confirmed that the invalid paths were accepted and mixed-case PNG/PDF received SVG. On the updated branch, I ran:cliandcli,fullfeatures;cargo ci-fmt;cargo ci-clippy;cargo ci-test, including the full CLI suite and doctests;--emit-codechecks.All of these passed. I could not run the mdBook build because
mdbookis not installed in my local environment, but I reviewed the Markdown changes directly as the source.I have a few questions where I would especially appreciate your preference:
Thank you for taking a look.
Type of change
Checklist
Library (new plot type)
Not applicable — this does not add or change a plot type or public library API.
Tests
cliandcli,fullcargo ci-test— the complete suite passed, including 80 CLI tests and 186 doctestscargo ci-fmtcargo ci-clippyCLI (if applicable)
BaseArgs::outputvalidation and help text updatedtests/cli_basic.rsupdated with output and content verificationdocs/src/cli/index.mdupdated with the new output contractman/kuva.1scope checked — flattened subcommand output options are not present, so regeneration produces no relevant changeDocumentation
README.mdoutput guidance updateddocs/src/cli/index.mdoutput guidance updated--helptext updated and inspectedmdbookis not installed in my local environment; changed Markdown was reviewed as sourceVisual inspection
Not applicable — this PR does not change plot rendering or layout. Mixed-case PNG and PDF output was validated structurally in the CLI tests.
Housekeeping
CHANGELOG.mdentry added under## [Unreleased]Enes K.