aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-11-26 01:34:18 +0100
committerMattias Andrée <maandree@kth.se>2016-11-26 01:34:18 +0100
commit3f29c77bb94c5e81dd46fb110aa090f767a10579 (patch)
treeaee04b052d7ecb1b1924b8b8097c8f1072fa7781
parentfirst commit (diff)
downloaddlu-3f29c77bb94c5e81dd46fb110aa090f767a10579.tar.gz
dlu-3f29c77bb94c5e81dd46fb110aa090f767a10579.tar.bz2
dlu-3f29c77bb94c5e81dd46fb110aa090f767a10579.tar.xz
Add manual
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--README47
-rw-r--r--dlu.176
-rwxr-xr-xdlu.py2
3 files changed, 124 insertions, 1 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..5046a99
--- /dev/null
+++ b/README
@@ -0,0 +1,47 @@
+NAME
+ dlu - Dictionary lookup utility
+
+SYNOPSIS
+ dlu (-l | dictionary word)
+
+DESCRIPTION
+ dlu looks up a selected word in a selected scanned dictionary.
+
+ dlu is configured via ~/.config/dlu/dlurc, a Python 3 file
+ which defines the functions:
+
+ list_dictionaries()
+ Returns a list of all dictionaries.
+
+ load_dictionary(dictionary : str)
+ Sets the fuction get() or a variable that get() reads
+ to identify which dictionary has been selected.
+
+ open_dictionary(file : str, page : int)
+ Opens the specified page in the specified file.
+
+ The default implementation opens atril(1), evince(1),
+ xpdf(1), or jfbview(1) to display the specified file
+ and page.
+
+ wordmod(word : str) -> str
+ Modifies and returns a word so that it can be used
+ to compare against known words in the dictionary.
+
+ The default implemention of this function covers the
+ word to lower case using Python's string class's
+ lower() function.
+
+ get() -> tuple
+ Returns a 3-tuple containing, in order: the filename
+ of the scanned dictionary, a list of the last word on
+ each page, and a int-to-int function that maps the
+ index of a word, in the list in the second element of
+ the returned tuple, to a page in the dictionary.
+
+OPTIONS
+ -l Print a list of all dictionaries.
+
+FILES
+ ~/.config/dlu/dlurc
+ The configuration file.
diff --git a/dlu.1 b/dlu.1
new file mode 100644
index 0000000..1cf8c40
--- /dev/null
+++ b/dlu.1
@@ -0,0 +1,76 @@
+.TH DLU 1 DLU
+.SH NAME
+dlu - Dictionary lookup utility
+.SH SYNOPSIS
+.B dlu
+.RI ( \-l
+|
+.I dictionary
+.IR word )
+.SH DESCRIPTION
+.B dlu
+looks up a selected
+.I word
+in a selected scanned
+.IR dictionary .
+.P
+.B dlu
+is configured via
+.BR ~/.config/dlu/dlurc ,
+a Python 3 file which defines the functions:
+.TP
+.BR list_dictionaries ()
+Returns a list of all dictionaries.
+.TP
+.BR load_dictionary "(\fIdictionary\fP : str)"
+Sets the fuction
+.BR get ()
+or a variable that
+.BR get ()
+reads to identify which
+.I dictionary
+has been selected.
+.TP
+.BR open_dictionary "(\fIfile\fP : str, \fIpage\fP : int)"
+Opens the specified
+.I page
+in the specified
+.IR file .
+
+The default implementation opens
+.BR atril (1),
+.BR evince (1),
+.BR xpdf (1),
+or
+.BR jfbview (1)
+to display the specified file and page.
+.TP
+.BR wordmod "(\fIword\fP : str) -> str"
+Modifies and returns a
+.I word
+so that it can be used to compare against known words
+in the dictionary.
+
+The default implemention of this function covers the
+.I word
+to lower case using Python's string class's
+.BR lower ()
+function.
+.TP
+.BR get "() -> tuple"
+Returns a 3-tuple containing, in order: the filename
+of the scanned dictionary, a list of the last word on
+each page, and a int-to-int function that maps the
+index of a word, in the list in the second element of
+the returned tuple, to a page in the dictionary.
+.SH OPTIONS
+.TP
+.B \-l
+Print a list of all dictionaries.
+.SH FILES
+.TP
+.B ~/.config/dlu/dlurc
+The configuration file.
+.SH BUGS
+Please report bugs to https://github.com/maandree/dlu/issues or to
+maandree@kth.se
diff --git a/dlu.py b/dlu.py
index 6d1eb6f..2a04348 100755
--- a/dlu.py
+++ b/dlu.py
@@ -8,7 +8,7 @@ global dictionary_name, sought_word, display_envs, x_reads, reads, wordmod, stan
if len(sys.argv) == 2 and sys.argv[1] == '-l':
f_list = True
elif len(sys.argv) != 3:
- print('Usage: dlu [DICTIONARY WORD | -l]', file = sys.stderr)
+ print('Usage: dlu (-l | DICTIONARY WORD)', file = sys.stderr)
sys.exit(1)
else:
dictionary_name = sys.argv[1]