Dushistov / sdcv

https://dushistov.github.io/sdcv/
GNU General Public License v2.0
294 stars 42 forks source link

ordering of dictionaries #5

Closed Dushistov closed 7 years ago

Dushistov commented 8 years ago

There are a couple of ways to deal with the ordering of dictionaries. For example, get ordering from a configuration file, from command line arguments or alphabetically. Actually they are all fairly easy to implement. Since the core library already have ordering capability, all we need is to construct an ordering list when the program starts.

I have written a patch that get ordering from command line. In particular, the ordering is the same as that of the '-u' arguments. For example when we invoke the program as following: $ sdcv -u "dict1" -u "dict2" -u "dict3" the result will be in "dict1" then "dict2" and finally "dict3".

This seems cumbersome, but at least, you can make an alias in your shell like alias sdcvorder="sdcv -u \"dict1\" -u \"dict2\" -u \"dict3\"" or write a wrapper shell script. Then this is virtually the same as getting the ordering from a configuration file except in one circumstance, that is, you have to specify the ordering of a dictionary in order to look up in it. In other words, you cannot give a partial ordering and leave others in random. However, the advantage is one can change the ordering on every invoke of the program. This is flexible when used in scripts or in emacs. Maybe someone will be able to propose a better way.

Dushistov commented 8 years ago

I hacked a new patch. When there is NO '-u' argument given, the program reads the ordering from '~/.sdcv_ordering', which is a text file containing one dictionary bookname per line.

Dushistov commented 8 years ago

sdcv-svn-order.patch.zip

Dushistov commented 8 years ago

Author of patch is gucong

Dushistov commented 8 years ago

Comment from another user:

It would be nice to be able to specify the order in which the output will be displayed when multiple dictionaries are installed (e.g., which dictionary will show first, which second, etc...).

A quick and simple solution would be order the output alphabetically according to the name of the folder in which the dictionary resides.