wikibase-cli

by maxlath

maxlath /wikibase-cli

read and edit a Wikibase instance from the command line

136 Stars 11 Forks Last release: Not found MIT License 1.0K Commits 184 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

wikibase-cli

The Command-line interface interface to Wikibase instances.

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

This project received a Wikimedia Project Grant.


wikibase           wikidata

NPM DockerHub Badge

License Node JavaScript Style Guide

Show your support by adding

{{#babel:Wikibase CLI}}
to your Wikidata user page userbox

Summary

Changelog

See CHANGELOG.md for version info

Dependencies

General

  • NodeJs >= v8 (recommended way to install it: use the awesome NVM)
  • 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
)
sh
npm install -g [email protected]
or just request the latest version
sh
npm install -g [email protected]

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:

sh
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 wikidata-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

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.