ropensci / emld

:package: JSON-LD representation of EML
https://docs.ropensci.org/emld
Other
13 stars 6 forks source link

Tweak eml_version to validate input and prompt when interactive #58

Closed amoeba closed 4 years ago

amoeba commented 4 years ago

Closes #57

Now you get a warning if you run eml_version("2.1.1"):

> eml_version("2.1.1")
[1] "2.1.1"
Warning message:
In eml_version("2.1.1") :
  Your provided version of '2.1.1' does not look like a valid version string. Be sure it starts with 'eml-' and ends with the schema version. e.g., for EML 2.1.1, use 'eml-2.1.1'.

and get asked, when called interactively, to pick from a list:

> eml_version()
Choose an EML version from the options below:

1: 2.1.1
2: 2.2.0

Selection: 
cboettig commented 4 years ago

:clap: nice!

Maybe just a nitpick, but would it be better just to make eml_version understand what eml_version("2.1.1") means, instead of insisting the user include the eml- prefix?

(i.e. so eml_version("2.1.1") returns "eml-2.1.1" ?)

amoeba commented 4 years ago

Maybe just a nitpick, but would it be better just to make eml_version understand what eml_version("2.1.1") means, instead of insisting the user include the eml- prefix?

Yeah, probably! I was just going with what I had in front of me. I'll tweak that and send off another PR.

amoeba commented 4 years ago

new PR at #59, have a look