Skip to content

Improve modern onliner graphic check#7099

Merged
seisman merged 1 commit intomasterfrom
graphic-check
Nov 21, 2022
Merged

Improve modern onliner graphic check#7099
seisman merged 1 commit intomasterfrom
graphic-check

Conversation

@PaulWessel
Copy link
Member

Closes #7098, hopefully. Basically, if option starts with one of the first letters in a valid graphics format, has an acceptable length (<= 4) but fails to match a valid format then we assume it is a typo and report that message. E.g.,

gmt basemap -Rg -JH20c -Ba -pnf map
gmt [ERROR]: Unrecognized graphics format pnf for modern mode one-liner command

@PaulWessel PaulWessel added enhancement Improving an existing feature maintenance Boring but important stuff for the core devs labels Nov 21, 2022
@PaulWessel PaulWessel added this to the 6.5.0 milestone Nov 21, 2022
@PaulWessel PaulWessel requested a review from seisman November 21, 2022 10:00
@PaulWessel PaulWessel self-assigned this Nov 21, 2022
@seisman seisman merged commit 2aa7f6e into master Nov 21, 2022
@seisman seisman deleted the graphic-check branch November 21, 2022 14:49
@seisman
Copy link
Member

seisman commented Nov 22, 2022

It seems this PR causes breaking changes:

gmt basemap -Rg -JH20c -Ba -t15 -png map
gmt [ERROR]: Unrecognized graphics format t15 for modern mode one-liner command

@PaulWessel
Copy link
Member Author

Lovely. Yes, I guess I should add the check that the characters following the initial valid start letter (e.g., -t) must be same case and all letters, e.g., -PNG for transparent png, -png, -tiff etc). I do not think we have a GMT module option that simply is two to four letters with those starting characters (e.g., -ps is the shortest, -tiff is longest). And next option should be a filename (e.g., -png map) and not an option.

PaulWessel added a commit that referenced this pull request Nov 22, 2022
COntiue to see #7099.  This PR adds as many further checks that we can to not get tripped up by -t15 thinking it is a bad -tiff.  Has to have same case letters only.
PaulWessel added a commit that referenced this pull request Nov 22, 2022
COntiue to see #7099.  This PR adds as many further checks that we can to not get tripped up by -t15 thinking it is a bad -tiff.  Has to have same case letters only.
@maxrjones maxrjones added the add-changelog Add PR to the changelog label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog enhancement Improving an existing feature maintenance Boring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the error message when invalid formats are used for one-liners

3 participants