maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
227 stars 24 forks source link

Add command `get-entity` #63

Closed nichtich closed 5 years ago

nichtich commented 5 years ago

To emit the JSON format of edit/create-entity. I think this is the same as

data --simplify --keep ids,references,qualifiers,nontruthy
nichtich commented 5 years ago

The question has been raised in https://github.com/maxlath/wikidata-cli/issues/68 but the answer to just use --simplify does not work because it eleminates qualifiers and references. The default should be round-tripping save to create-entity

maxlath commented 5 years ago

what would you think of a skeleton command, tailored to work with both wd edit-item and wd create-item:

nichtich commented 5 years ago

Yes, that would be less confusable with command data. Options that make sense:

-p, --props <props>  as in wd-data
-l, --lang <langs> limit data so selected language(s)
-f, --format <format>  Default: json. Alternatives: js
maxlath commented 5 years ago

I just published v7.3.0, which includes a new command based on this idea: [wd generate-template] (https://github.com/maxlath/wikidata-cli/blob/master/docs/read_operations.md#wd-generate-template).

Instead of --lang, I went for a more precise version of props:

wd generate-template Q123 --props labels.de,sitelinks.dewiki

As for the JS format, the implementation is somewhat hacky, but it seems to work from what I could see, could you give it a try?

wd generate-template Q123 --format js