Skip to content
This repository has been archived by the owner on Sep 11, 2021. It is now read-only.

travis-g/dict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

 
 
 

Languages