Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable default languages #16

Open
rbaron opened this issue Sep 6, 2018 · 2 comments
Open

Configurable default languages #16

rbaron opened this issue Sep 6, 2018 · 2 comments

Comments

@rbaron
Copy link
Owner

rbaron commented Sep 6, 2018

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 🙂

@aaschmid
Copy link
Contributor

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 "$@"

``

@trin94
Copy link

trin94 commented Aug 26, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants