Closed ronaldtse closed 2 years ago
3. Make it a real CLI using Thor and include it in gemspec as an executable under
exe/nist-pubid
:% nist-pubid -c "NBS BH 10"
If we are using Thor, commands will be a little longer, we need to use task names (if I understand correctly):
% nist-pubid convert "NBS BH 10"
% nist-pubid convert -d "NBS.BH.10"
(for doi)
% nist-pubid report -f csv
% nist-pubid convert -d "NBS.BH.10" -s short
% nist-pubid convert -d "NBS.BH.10" -s all -f json
@ronaldtse Is that ok?
@mico yes, that's actually excellent. Thanks!
Converting from DOI (-d for DOI, -r for revision, -e for edition, --vol for version)
Do we need to support all options to create PubID from parts like revision, edition, version, volume, supplement, part, etc?
Also, we don't need "-d for DOI" parameter here because parser already made to parse DOI and PubID without pointing what format it is.
It would be better to support them, yes.
Please feel free to come up with a suitable syntax. Thanks.
@ronaldtse from skype: Also, there are two identifiers they need to diff:
For each record in CSV, we should generate a diff between these two formats, so that the NIST library folks can see what becomes impacted.
For each record in CSV, we should generate a diff between these two formats, so that the NIST library folks can see what becomes impacted.
About diff, what do you mean? Is it standard diff or what? For standard diff it doesn't make much sense, it will look like:
- LCIRC 897
+ NBS.LCIRC.897
@mico by diff I just mean a compare.
e.g. this would already work:
Changed,New PubID,Document ID,DOI changed,DOI,New MR,Title + subtitle
YES,NBS LCIRC 897,LCIRC 897,NO,NBS.LCIRC.897,NBS.LCIRC.897,...
...
I updated "Changed" logic. Now it's changed also when "DOI" different from "New MR".
@mico can you update the README on how to use the CLI today? Thanks.
Can we make these changes to the CLI:
Change header to:
exe/nist-pubid
:Instead of
And I should be able to
Support CSV output e.g.
CLI conversion for single document ID support document ID and DOI
Converting from DOI (-d for DOI, -r for revision, -e for edition, --vol for version)
% nist-pubid -d "NBS.BH.10"
=> NBS BH 10
Converting from DOI to PubID short style (-s for style)
% nist-pubid -d "NBS.BH.10" -s short
=> NBS BH 10
Converting from DOI to all PubID styles in JSON
% nist-pubid -d "NBS.BH.10" -s all -f json
=>
{ "styles": { "short": "NBS BH 10", "abbrev": "", / not available for BH / "long": "National Bureau of Standards Building and Housing Report 10", "mr": "NBS.BH.10", }, "publisher": "NBS", "series": "BH", "reportnumber": "10", "edition": 1, ... }