metanorma / pubid-nist

BSD 2-Clause "Simplified" License
1 stars 2 forks source link

Improvement to CLI usage and table comparison #33

Closed ronaldtse closed 2 years ago

ronaldtse commented 2 years ago

Can we make these changes to the CLI:

  1. In the table comparison mode, we also want to highlight which roles changed the ID:

Change header to:

Changed | New PubID | Document ID | DOI | Title + subtitle
✅ | (changed ID compared between PubID and Document ID)...
- | (no change)
  1. Make it a real CLI using Thor and include it in gemspec as an executable under exe/nist-pubid:
$ bundle exec nist-pubid   # During development
$ nist-pubid               # After install

Instead of

$ ./nist-pubid

And I should be able to

  1. Support CSV output e.g.

    % nist-pubid -s -f csv
    # => CSV output
  2. CLI conversion for single document ID support document ID and DOI

    
    # Converting from document ID (-c for convert)
    % nist-pubid -c "NBS BH 10"
    # => NBS BH 10

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, ... }



_Originally posted by @ronaldtse in https://github.com/metanorma/nist-pubid/issues/20#issuecomment-1006194741_
mico commented 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?

ronaldtse commented 2 years ago

@mico yes, that's actually excellent. Thanks!

mico commented 2 years ago

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.

ronaldtse commented 2 years ago

It would be better to support them, yes.

ronaldtse commented 2 years ago

Please feel free to come up with a suitable syntax. Thanks.

mico commented 2 years ago

@ronaldtse from skype: Also, there are two identifiers they need to diff:

  1. The short PubID. Old ID vs new PubID.
  2. The MR PubID. The DOI string vs new MR PubID.

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.

mico commented 2 years ago

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
ronaldtse commented 2 years ago

@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,...
...
mico commented 2 years ago

I updated "Changed" logic. Now it's changed also when "DOI" different from "New MR".

ronaldtse commented 2 years ago

@mico can you update the README on how to use the CLI today? Thanks.