sdcv

Sdcv is a command line dictionary. It provides access to dictionaries in StarDict's format.

Installation

Install the sdcv package.

Usage

sdcv can be started from the command line:

$ sdcv

This gives you a 'shell-like' command-line from which you can query the database.

Adding dictionaries

There are various places on the web where you can download StarDict dictionaries (e.g. https://web.archive.org/web/20200702000038/http://download.huzheng.org/).

Once you have the appropriate files you can extract them into /usr/share/stardict/dic.

If you do not have root permission, you can set the STARDICT_DATA_DIR environment variable:

STARDICT_DATA_DIR=$XDG_DATA_HOME

sdcv will look in the dic subdirectory so make sure that it is created and then place your dictionary files inside it.

If all is done correctly, sdcv should be able to output definitions for words passed into it.

Tips and tricks

Output Formatting

You can use a wrapper around sdcv to conveniently format its output (Source):

function def() {
	sdcv -n --utf8-output --color "$@" 2>&1 | \
	fold --width=$(tput cols) | \
	less --quit-if-one-screen -RX
}

An environment variable can achieve similar formatting functionality without the need of a wrapper, affecting all normal calls of sdcv:

SDCV_PAGER='less --quit-if-one-screen -RX'

Piping also works:

SDCV_PAGER='lolcat -f | less --quit-if-one-screen -RX'

See Also

gollark: <@!506482395269169153> you do not have magic powers.
gollark: +rule ly/ric:purple impl ements zo/ab:blue:property rg/le:blue:property
gollark: +rule ly/ric:purple implements zo/ab:blue:property rg/le:blue:property
gollark: ++remind 1d POTATO NOT BAD <@160279332454006795> <@160279332454006795>
gollark: hd!histohist 345300752975003649 <@731434948250173501> <@593113791252660224> <@&701761313294123098>
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.