dict

command module
v0.0.0-...-83ff1ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2019 License: MIT Imports: 17 Imported by: 0

README

dict

GitHub

A CLI for querying Oxford Dictionaries' API. Functions and features:

  • Look up a word's definition, synonyms, and antonyms,
  • Manpage-like or simplified output formats,
  • Retrieve raw JSON API responses,
  • Optional HTML page generation using Blackfriday, a Markdown renderer.

V2 API Changes

V2 of Oxford Dictionaries' API removes free access to the thesaurus endpoint. Synonym and antonym lookups will fail with a Prototype tier plan or lower.

Installation

With a proper Go environment set up:

$ go get -u -v github.com/travis-g/dict
github.com/travis-g/dict (download)
...

Before using the CLI you'll need to retrieve an API key from the Oxford Dictionaries developer portal. You will also need to create a .dictrc.yaml file in your home directory (other filetypes work but are not documented). The CLI will fall back to checking the current working directory for a config file.

The .dictrc.yaml config file should have the following properties:

app_id: <APP_ID>
app_key: <APP_KEY>
api_url: https://od-api.oxforddictionaries.com/api/v2
region: en-gb # or "en-us" for the New Oxford American Dictionary

Note that certain spellings are used in only certain regions (try "skillful" vs. "skilful" across regions).

Usage

$ dict -h
NAME:
   dict - Oxford Dictionary CLI tool

USAGE:
   dict [global options] command [command options] [arguments...]

VERSION:
   ...

COMMANDS:
     antonyms, a  look up antonyms
     define, d    define a word
     synonyms, s  look up synonyms
     help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

For example, to look up the definition of "console":

$ dict define "console"
console
=======

...

The raw JSON response object can be output with the --raw or -r flag:

$ dict define --raw console
{"metadata":{"provider":"Oxford University Press"},"results":[...]}

The subcommands have their own usage information.

Notes

License

Source code is available under the MIT license.

Please be sure to read Oxford Dictionaries' Terms and Conditions and their FAQ.

Powered by OXFORD

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL