dict.cc.py icon indicating copy to clipboard operation
dict.cc.py copied to clipboard

Configurable default languages

Open rbaron opened this issue 7 years ago • 2 comments

It would be great if we could avoid having to type the source and target language all the time. Instead of doing:

$ dict.cc.py en de body

We could let users configure which languages they would like to be the default, so they could avoid having to type en de all the time (although they can type it if they want non-default options):

$ dict.cc.py body

Two ideas for handling this config:

  • Config file in the user's home dir (e.g.: ~/.dict.cc.py.yaml)
  • Environment variables (e.g.: DICT_CC_PY_LANGS="en de")

I tend to favor the first approach, but at this complexity level it's a matter of personal taste 🙂

rbaron avatar Sep 06 '18 20:09 rbaron

Alternatively, I created some little scripts for this:

#!/bin/sh

set -eu

if [ $# -le 0 ]; then
    echo "Provide argument to be translated!"
    exit 1
fi

/usr/lib/python3.6/site-packages/dict.cc/dict.cc.py en de "$@"

``

aaschmid avatar Sep 11 '18 11:09 aaschmid

For zsh I use

function join_by { local IFS="$1"; shift; echo "$*"; }
function dict { dict.cc.py --max-results 12 en de "$*" | grep --color -Ei "$(join_by \| $*)|$"; }

image

trin94 avatar Aug 26 '19 07:08 trin94