Code Monkey home page Code Monkey logo

wikibase-cli's Introduction

wikibase-cli

The Command-line interface interface to Wikibase instances.

This tool is mostly a CLI interface to the JS modules wikibase-edit and wikibase-sdk, + some treats for the CLI lovers. And a batch mechanism to process millions of edits.

It was primarily developed to target Wikidata, but as then been decoupled to support any Wikibase instance.

Supported systems: any system that can run NodeJS (Linux, Mac OS, Windows, and more)

This project received a Wikimedia Project Grant.


wikibase           wikidata

NPM DockerHub Badge

License Node JavaScript Style Guide

Download stats

Show your support by adding {{#babel:Wikibase CLI}} to your Wikidata user page

userbox_wikibase_cli

Summary

Changelog

See CHANGELOG.md for version info

Dependencies

General

  • NodeJs >= v14 (recommended way to install it: use the awesome NVM to install the latest LTS version nvm install --lts)
  • Git

Per feature

  • to use the clipboard option: see copy-paste dependencies

Installation

via npm

npm install -g wikibase-cli

Installing globally allows to make the command wb (and wd, the Wikidata-bound verion of wb) accessible from your shell $PATH.

If you later need to update the package to a different version, you can run the same command but specifying the version you want (here 12.2.0)

npm install -g [email protected]

or just request the latest version

npm install -g wikibase-cli@latest

via docker

# Might require to be run with sudo depending on your Docker installation
docker run --rm -t maxlath/wikibase-cli
# You can make an alias out of it:
alias wb="docker run --rm -it maxlath/wikibase-cli"
# You're then ready to use it as in the documentation examples
wb label Q1

That would work, but all operations cached data (such as the list of all properties) would need to re-fetch those data for each operations, and all write operations would require you to re-enter your credentials everytime. To work around this, you can allow this container to persist some files on your system, using shared volumes:

mkdir -p $HOME/.config/wikibase-cli $HOME/.cache/wikibase-cli
alias wb='docker run --rm -v "$HOME/.config/wikibase-cli:/root/.config/wikibase-cli" -v "$HOME/.cache/wikibase-cli:/root/.cache/wikibase-cli" -it maxlath/wikibase-cli'

NB: Beware that using wikibase-cli through a Docker container has a performance cost of something like 1s per command, so if you need to run many commands (for instance in a script to make mass edit on the desired Wikibase instance), you should probably rather use the NPM package directly

Commands

Read operations

See Read operations

wd summary Q1

Write operations

See Write operations

Config

Allows to persist options

See Config

Debug

To get debugging informations, set the DEBUG environment variable:

# Print all wikibase-cli-specific debugging information
export DEBUG=wikibase-cli ; wb
# Also print wikibase-edit debugging information
export DEBUG=wikibase-* ; wb
# Print only request debugging information
export DEBUG=wikibase-cli:request ; wd label Q1

See Also

You may also like

inventaire banner

Do you know Inventaire? It's a web app to share books with your friends, built on top of Wikidata! And its libre software too.

License

MIT

wikibase-cli's People

Contributors

addshore avatar almereyda avatar jacksonchen666 avatar maxlath avatar nataschake avatar nichtich avatar pdehaye avatar pythoncoderas avatar rwst avatar simon04 avatar tmtmtmtm avatar waldyrious avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wikibase-cli's Issues

config.md does not hint at passwords being stored in clear text

The config.md documentation document suggests users to store their account credentials for allowing write operations.

The special page write_operations.md mentions the fact of clear text storage, but far away even from README.md.

Would it be possible to provide the password as a secure hash to the remote auth endpoint instead?

TypeError: Cannot read property 'type' of undefined

After following an ominuous link in the documentation and recreating a JSON following the example as of q224.json as

{
  "id": "Q224",
  "claims": {
    "P4": "Q6",
    "P8": "Q218"
  }
}

with a valid configuration for a custom Wikibase instance, a stacktrace is thrown:

~/.tmp $ wd edit-item q224.json
TypeError: Cannot read property 'type' of undefined
    at module.exports.propertyId (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/properties/find_datatype.js:24:55)
    at module.exports (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/build_claim.js:9:20)
    at obj.(anonymous function).values.map.value (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/format.js:40:39)
    at Array.map (native)
    at /home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/format.js:40:26
    at Array.reduce (native)
    at Object.claims (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/format.js:22:32)
    at module.exports.data (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/validate_and_format_data.js:31:33)
    at err (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/edit.js:17:22)
    at _validateAndFormatData (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/edit.js:15:10)
    at data (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-edit/lib/entity/edit.js:7:12)
    at cmd (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/lib/edit/edit_command.js:38:50)
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)

wd claims should also emit claim guids

I'd like to get a claim guid for editing wd claim $subject $property prints the simplified object value. I'd expect some option, e.g. wd claims --guid $subject $property.

Don't write to install directory

If you have installed wikidata-cli with your distros package manager (e.g. pacman) and not with npm, you have to run it with root rights. Otherwise you'll get:
EACCES: permission denied, open '/usr/lib/node_modules/wikidata-cli/props/de.json'

wdprops fails

$ wdprops

Unhandled rejection Error: ENOENT: no such file or directory, open '~/.nodebrew/node/v5.11.1/props/node_modules/wikidata-cli/lib/en.json'
    at Error (native)

Dump existing item as JSON

How can I dump an existing item as JSON?

I would like to create new items from csv column data while using JSON 'skeleton' files. Have you once tried something?
wd edit-item ./new_item_data.json

Error: spawn EACCES

Getting this error when I try to run any command on wikidata-cli. For background, I just installed the module and using node v8.

Does not work with sudo either, what could be wrong?

planemad:dashboards arun$ wd summary Q42
internal/child_process.js:325
    throw errnoException(err, 'spawn');
    ^

Error: spawn EACCES
    at _errnoException (util.js:1024:11)
    at ChildProcess.spawn (internal/child_process.js:325:11)
    at exports.spawn (child_process.js:499:9)
    at Command.executeSubCommand (/usr/local/lib/node_modules/wikidata-cli/node_modules/commander/index.js:552:14)
    at Command.parse (/usr/local/lib/node_modules/wikidata-cli/node_modules/commander/index.js:477:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/wikidata-cli/bin/wd:63:2)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)

Some commands dont return multiple values

I've tried summary, label and description all of which suggest it is possible to get multiple results by providing multiple IDs, e.g.:

wd label Q18120925 Q22117436 Q22117437

I can only get the first result back. Am I doing anything wrong?

feature to list the history of an item

Listing all revision of the entry in Wikidata, possibly supporting filters like, "all changes since", or "all changes by". My use case is one where I like to monitor changes to the pages I created. Using your tool and these feature I could set up a crontab allowing me to report all the changes to a set of pages (likely one CLI call for one page) since the last time I run that crontab.

plain wd config fails if no keys have been defined

$ wd config
/usr/local/lib/node_modules/wikidata-cli/bin/wd-config:13
  config.password = config.password.replace(/./g, '*')
                                   ^

TypeError: Cannot read property 'replace' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/wikidata-cli/bin/wd-config:13:36)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:423:7)
    at startup (bootstrap_node.js:147:9)
    at bootstrap_node.js:538:3

add claim doesn't support monolingual text

Similar to issue #30 in that it's about an unsupported datatype.

The datatype monolingual string requires a two parts: A language code and a string. It's currently not possible to add that via this tool (or, alternatively, I don't know the correct syntax to do so). In QuickStatements, the syntax to do this is languagecode:"string", perhaps the same syntax should be used here? Tested with P1705.

include write operations

As pointed here, wikidata-cli doesn't offer write operations such as adding a claim to an entity and alikes.

I see two possible paths to get there:

  • integrate wikidata-agent
  • modularize wikidata-agent to use directly its logic without the server wrapper

wikidata-cli alias does not work

After the thankful implementation of #42, this still does not work with a fresh global install:

λ wikidata-cli --help
/home/ya/.nvm/versions/node/v8.9.4/bin/wikidata-cli: Zeile 2: ./bin/wd: No such file or directory

This may be linked with #21 and #25.

Problem when I try to install Wikidata-cli

Hi,

When I try to install wikidata-cli with this command on Ubuntu 16.04 "sudo npm install -g wikidata-cli" I get a message error of this kind :
"npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone -q https://github.com/maxlath/commander.js.git /home/gonthier/.npm/_cacache/tmp/git-clone-a1c0dfdb
npm ERR! /home/gonthier/.npm/_cacache/tmp/git-clone-a1c0dfdb/.git: Permission non accordée
"

It seems to be a permission denied error.

You can found the log file attached.

Do you have any idea of the origin of this problem ?

Thanks,
2017-12-22T12_47_59_002Z-debug.log

Enable mounting config while using docker

So the main thing that stops a user from being able to mount a config into the image while using docker to run the command is the fact that the config file is in the same dir as the code.

For example, in the docker image currently the config is @ /usr/local/lib/node_modules/wikidata-cli/config.json

If we could change that to /usr/local/lib/node_modules/wikidata-cli/config/config.json then the config dir could be mounted from the local system when running using docker.
This would mean the config could persist between containers.

the via docker README could then be updated to show

# Might require to be run with sudo depending on your Docker installation
docker run --rm -it maxlath/wikidata-cli
# If you want to mount a local file for the config
docker run --rm -it -v /home/addshore/.config-wikidata-cli:/usr/local/lib/node_modules/wikidata-cli/config maxlath/wikidata-cli
# You can make an alias out of it:
alias wd="docker run --rm -t maxlath/wikidata-cli"

Cannot login with my regular account

Do I have to use a bot account? The error suggests otherwise, but I'm not sure how to proceed:

$ wd set-label Q4115189 pt "Testing wikidata-cli"
This operation requires to set your Wikidata crendentials
prompt: Wikidata username:  Waldir
prompt: Wikidata password:  [redacted]
Authentication requires user interaction, which is not supported by action=login. To be able to login with action=login, see [[Special:BotPasswords]]. To continue using main-account login, see action=clientlogin.
prompt: Wikidata username:  Waldir
prompt: Wikidata password:  [redacted]
Authentication requires user interaction, which is not supported by action=login. To be able to login with action=login, see [[Special:BotPasswords]]. To continue using main-account login, see action=clientlogin.

(Since this seemed to be a loop, at this point I exited with Ctrl+C).

Properties of a custom instance are not propagated

In using some read commands, we encounter error due to different than expected properties:

λ wd claims Q219
the property P4 could not be found
run `wd props --reset` to refresh the local properties list
λ wd props --reset
properties reset
λ wd claims Q219
the property P4 could not be found
run `wd props --reset` to refresh the local properties list

writting properties files may trigger EACCES: permission denied errors

created a dedicated thread for this issue discussion started in here
@nichtich:

there is a bug if you installed wikidata-cli globally:

$ qclaims Q2112 P625
Error: EACCES: permission denied, open '/usr/local/lib/node_modules/wikidata-cli/props/de.json'
    at Error (native) 
Context:
 undefined

@maxlath:

Damn, I didn't see that "permission denied" message coming: I installed node with nvm which setups node modules in the home folder /home/username/.nvm/versions/node/v4.4.5/lib/node_modules/wikidata-cli/props/de.json. Would the solution be to create a dedicated folder in the user home (like /home/username/.wikidata-filter) where we would have the right to write anything that we need?
Fyi, another consumer of those properties files is wdprops and the properties are taken fresh out of the SPARQL endpoint: we got to cache that in some way to avoid spamming the endpoint with what starts to be a heavy query, thus the use of local files.

Writing Time/Date to WD Records

I'm running into some issues adding claims with time/date data.

For example, wd ac Q50278901 P580 "1983" will result in writing "time": "+1983-00-00T00:00:00Z" to the WD record, but WD will not accept YYYY-MM-DD -- or any variations of it -- as a date format:

image

Runtime error

After installing with sudo npm install -g wikidata-cli I get this error when running wd config or other commands presented in the README.md - any idea what I'm doing wrong? node -v (through nvm) is 6.8.1

fs.js:248
  binding.access(pathModule._makeLong(path), mode);
          ^

Error: ENOENT: no such file or directory, access '/home/guerry/.config/wikidata-cli'
    at Error (native)
    at Object.fs.accessSync (fs.js:248:11)
    at Object.writeAccessSync (/usr/local/lib/node_modules/wikidata-cli/lib/fs.js:26:8)
    at module.exports (/usr/local/lib/node_modules/wikidata-cli/lib/get_folder_path.js:18:8)
    at Object.<anonymous> (/usr/local/lib/node_modules/wikidata-cli/lib/config/file_path.js:2:51)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Logging in on a custom instance does not work and is rate limited

When using our custom instance, a working combination of username and password cannot login:

wikidata-cli set-label Q223 sk "Rodová rovnosť"                                                                                                                
{ Error: login error                                                                                                                                           
    at breq.post.then.res (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-token/lib/login.js:56:21)                    
    at tryCatcher (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/util.js:16:23)                            
    at Promise._settlePromiseFromHandler (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:512:31) 
    at Promise._settlePromise (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:569:18)            
    at Promise._settlePromise0 (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:614:10)           
    at Promise._settlePromises (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:693:18)           
    at Async._drainQueue (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:133:16)                   
    at Async._drainQueues (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:143:10)                  
    at Immediate.Async.drainQueues (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:17:14)          
    at runCallback (timers.js:789:20)                                                                                                                          
    at tryOnImmediate (timers.js:751:5)                                                                                                                        
    at processImmediate [as _immediateCallback] (timers.js:722:5)                                                                                              
  statusCode: 200,                                                                                                                                             
  body:                                                                                                                                                        
   { login:                                                                                                                                                    
      { result: 'Failed',                                                                                                                                      
        reason: 'Incorrect username or password entered. Please try again.' } } }                                                                              
wikidata-cli set-label Q224 sk "Čistá voda a hygiena"                                                                                                          
{ Error: login error                                                                                                                                           
    at breq.post.then.res (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/wikidata-token/lib/login.js:56:21)                    
    at tryCatcher (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/util.js:16:23)                            
    at Promise._settlePromiseFromHandler (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:512:31) 
    at Promise._settlePromise (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:569:18)            
    at Promise._settlePromise0 (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:614:10)           
    at Promise._settlePromises (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:693:18)           
    at Async._drainQueue (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:133:16)                   
    at Async._drainQueues (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:143:10)                  
    at Immediate.Async.drainQueues (/home/ya/.nvm/versions/node/v8.9.4/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:17:14)          
    at runCallback (timers.js:789:20)                                                                                                                          
    at tryOnImmediate (timers.js:751:5)                                                                                                                        
    at processImmediate [as _immediateCallback] (timers.js:722:5)                                                                                              
  statusCode: 200,                                                                                                                                             
  body:                                                                                                                                                        
   { login:                                                                                                                                                    
      { result: 'Failed',                                                                                                                                      
        reason: 'You have made too many recent login attempts. Please wait 5 minutes before trying again.' } } }                                               

binary alias has different name than package

The npm i -g wikidata-cli installs a binary alias for wd, which is different from the title of the actual package. Expected would be to access the module by calling its original name, i.e. wikidata-cli. Users who like implicit naming could then set up a custom alias by themselves.

Add option to set botflag on commits

A bit of background first: I'm currently running an import using wikidata-cli, with a properly identified bot account. Today, an user asked me why contributions appear as coming from a human while it's done by a flagged bot. After a bit of digging, I discovered changesets, along with summary, minor edit flags, (…) also have a botflag value. This value must be set to true for every modification done by a bot, so it doesn't appear in default recent changes view. And it's a requirement
I digged into wikidata-cli, but I found no way to force this flag to be set, so I'm pretty much stuck.

Now comes my enhancement request:
Is there a way to add such an option into wikidata-cli?
I spent about 30 minutes looking through the wikidata-cli source code, to check how this could hypothetically be implemented.
As a first guesstimate, a good option would be to add a boolean entry in config.json file that indicates if bot flag must be set or not for the given user credentials. This could be added into data structure given to wikidata-edit's request.js's actionPost().

That's where I'm for now.
Any thoughts?

borrow ideas from WDQ

wikidata-cli is js (nodejs) and WDQ is perl. Both are super useful in scripts.
But it would be great if they borrow ideas from each other, and maybe even unify the commands and syntax to some extent.

https://github.com/nichtich/wdq has some nice stuff you don't yet have, eg

support piping

In the commander branch

./bin/wd data Q1 | head
{
    "pageid": 129,
    "ns": 0,
    "title": "Q1",
    "lastrevid": 369618258,
    "modified": "2016-08-26T03:50:30Z",
    "type": "item",
    "id": "Q1",
    "labels": {
        "en": {
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at Object.exports._errnoException (util.js:870:11)
    at exports._exceptionWithHostPort (util.js:893:20)
    at WriteWrap.afterWrite (net.js:763:14)

TypeError: url.replace is not a function

When querying against a custom Wikibase instance, the following error occurs:

$ wd config instance https://base.transformap.co/api.php  
$ wd summary Q218                                       
Label Ziele für nachhaltige Entwicklung
Description Die Ziele für nachhaltige Entwicklung sind politische Zielsetzungen der Vereinten Nationen (UN), die der Sicherung einer nachhaltigen Entwicklung auf ökonomischer, sozialer sowie ökologischer Ebene dienen sollen. Die Ziele wurden in Anlehnung an den Entwicklungsprozess der Millenniums-Entwicklungsziele (MDGs) entworfen und traten am 1. Januar 2016 mit einer Laufzeit von 15 Jahren (bis 2030) in Kraft. Im Unterschied zu den MDGs, die insbesondere Entwicklungsländern galten, gelten die SDGs für alle Staaten.
TypeError: url.replace is not a function
    at unwww (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/lib/custom_wikibase_instance.js:22:28)
    at customize (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/lib/custom_wikibase_instance.js:24:28)
    at Object.wdk.customize (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/lib/customized_wdk.js:11:27)
    at ids (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/lib/get_labels.js:12:22)
    at module.exports (/home/ya/.nvm/versions/node/v6.9.4/lib/node_modules/wikidata-cli/lib/log_claims.js:11:5)
Context: undefined

Fails on entities with too recent properties

wikidata-cli fails when reading/writing entities containing very recent properties.
i.e:

$ wd claims Q41610011
TypeError: Cannot read property 'type' of undefined
    at BuildClaimsText (/usr/lib/node_modules/wikidata-cli/lib/log_claims.js:43:39)
    at Promise.all.then.results (/usr/lib/node_modules/wikidata-cli/lib/log_claims.js:22:28)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

It fails because of the P4276, created yesterday.

The property is not in the known props list:

$ wd p
[…]
  "P4241": null,
  "P4242": "vitesse ascensionnelle (maximale)",
  "P4243": null
}

I'm not sure it's an outdated server cache, or a runtime local info that is has to be updated.
Is there a workaround?

wikiqid Apple gets an exception (node 5.7.1)

wikidata-cli 1.3.1

$ wikiqid Apple

TypeError: Cannot convert undefined or null to object
    at Function.keys (native)
    at parseIds (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/bin/wikiqid:43:20)
    at tryCatcher (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:502:31)
    at Promise._settlePromise (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:559:18)
    at Promise._settlePromise0 (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:604:10)
    at Promise._settlePromises (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/promise.js:683:18)
    at Async._drainQueue (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues [as _onImmediate] (~/.nodebrew/node/v5.7.1/lib/node_modules/wikidata-cli/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Cannot read property 'W_OK' of undefined

Running wd s Q1 gives me the following issue on version 4.8.3

~/.nvm/versions/node/v6.2.2/lib/node_modules/wikidata-cli/lib/get_folder_path.js:17
    if (err.code !== 'EACCES') throw err
                               ^

TypeError: Cannot read property 'W_OK' of undefined
    at Object.module.exports.writeAccessSync (/Users/Kevin/.nvm/versions/node/v6.2.2/lib/node_modules/wikidata-cli/lib/fs.js:26:37)
    at module.exports (/Users/Kevin/.nvm/versions/node/v6.2.2/lib/node_modules/wikidata-cli/lib/get_folder_path.js:15:8)
    at Object.<anonymous> (/Users/Kevin/.nvm/versions/node/v6.2.2/lib/node_modules/wikidata-cli/lib/get_cache_folder_path.js:2:49)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)

Error when searching using verbose mode

{ Error: Command failed: /bin/sh -c export FORCE_COLOR=true; /usr/local/node_modules/wikidata-cli/lib/bin/wd summary Q7159553 --lang es
/bin/sh: /usr/local/node_modules/wikidata-cli/lib/bin/wd: No such file or directory

    at ChildProcess.exithandler (child_process.js:275:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:554:12)
  killed: false,
  code: 127,
  signal: null,
  cmd: '/bin/sh -c export FORCE_COLOR=true; /usr/local/node_modules/wikidata-cli/lib/bin/wd summary Q7159553 --lang es',
  stdout: '',
  stderr: '/bin/sh: /usr/local/node_modules/wikidata-cli/lib/bin/wd: No such file or directory\n' }```

provide Oauth support instead of username/password

Passwords are being stored in clear text

Coming from the discussion in #44, we have discovered that credential storage is leaking private credentials where unneccessary. A possibility to circumvent that could be a command switch to launch an interactive REPL to query for the password during runtime, instead of leaving it as plain text in the file system.

Where in

ce7737a

we ask ourselves to find a better way to do this, #25 offers a possible implementation route.

TypeError: Cannot read property 'simplifySparqlResults' of undefined

I just installed wikidata-cli using npm install -g wikidata-cli, and tried doing wd s Q186055. Here's the output:

Label git
Description free and open source revision control software
TypeError: Cannot read property 'simplifySparqlResults' of undefined
    at body (/usr/local/lib/node_modules/wikidata-cli/lib/fetch_lang_props.js:22:6)
    at process._tickCallback (internal/process/next_tick.js:109:7)
Context: undefined

Define common options/option letters

Before option letters become rare, better think about common options. The same letter should not be used for different options in different commands unless it's a very special command. So far there are:

  • -a, --labels display/select/.. labels
  • -d, --debug
  • -l, --lang language a label to query, select, provide, display...
  • -o, -object (to read and write claims)
  • -p, -property (to read and write claims)
  • -p, --wikipedia (why -p?)
  • r, --reset clear a cache (could also be used for SPARQL and write operations)
  • -r, --raw output raw SPARQL results (should better be --format sparql!)
  • -s, --subject (to read and write claims)
  • -t, --limit result number limit (plus alias -1...-9)

Some options could better be made arguments, for instance:

wd open wiki Q123 # open Wikipedia.if "wikipedia".startsWith(argv[1]) or argv[1] == "wp"
wd open dewiki Q123 # open German Wikipedia

I'd think about reserving for future use:

  • -c, --count or -c, --claim?
  • `-f, --format '
  • `-q, --quiet'
  • -i, --identifier or -i, --index?
  • -u, --uris
  • -n, --no-execute/--dry-run to not perform any remote request
  • -m, --summary/--message <summary> edit summary (like in git commit)
  • `-v, --verbose'
  • -w, --wiki/--site for site such as dewiki

Anyway: better not assign option letters by first-come-first-serve but with a wider plan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.