Skip to content

Commit e66fd06

Browse files
committed
Added spellcheck. fixes #7
1 parent b418a3b commit e66fd06

File tree

5 files changed

+68
-3
lines changed

5 files changed

+68
-3
lines changed

docs/RELEASE-NOTES.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# STANDARD(?) UNIX NOTES
22
# RELEASE NOTES
33

4+
2.5
5+
- Added spelling check to 'add' and 'edit' sub-commands
6+
- Added prompt in config commands for choice of spelling
7+
checker
8+
49
2.4
510
- Added backup sub-command (creates GnuPG encrypted
611
tarball in HOME)

docs/ROADMAP.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
44
ROADMAP
55

6+
2.5 Added spelling check to 'add' and 'edit' sub-commands
7+
68
2.4 Added backup sub command
79

810
2.3 Use GNU shred(1) where available

docs/USING_NOTES.md

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ note* you will create 'my_new_note'.
1212
If available *notes* will use GNU shred(1) to delete any temporary
1313
files. If unavailable it will default back to rm(1).
1414

15+
## Spelling
16+
17+
Unix Notes can be configured to use aspell(1), ispell(1) or 'none' using
18+
the *spelling=* directive in the *config* file. This setting is
19+
configured in the *init* sub-command on first run.
20+
1521
## Sub-command config
1622

1723
Displays the 'config' file and also the DEFAULT and USE (current)

docs/notes.1

+14
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ config file.
5555
From version 1.8 onwards Notes/Notebook support Bash completion for sub
5656
commands and note/notebook filenames.
5757

58+
.SH SPELL CHECKING
59+
60+
Notes(1) can be configured to use aspell(1) or ispell(1) to check the
61+
spelling of the decrypted file during the \fBadd\fP and \fBedit\fP
62+
sub-commands.
63+
64+
To change spell checkers edit \fBspelling=\fP the config file to have
65+
one of the following:
66+
.RS
67+
.IP spelling=aspell
68+
.IP spelling=ispell
69+
.IP spelling=none
70+
.RE
71+
5872
.SH COMMANDS
5973

6074
The notes program takes a set of commands that allows the user to manipulate the

notes

+41-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,26 @@ else
3838
SHREDCMD="rm"
3939
fi
4040

41-
#
41+
SPELLCHECK=`grep spelling $CONFIGFILE | cut -d'=' -f 2`
42+
43+
spellcheck () {
44+
case ${SPELLCHECK} in
45+
aspell)
46+
SPELLINGCMD="aspell -x -c "
47+
${SPELLINGCMD} ${notefile}
48+
;;
49+
ispell)
50+
SPELLINGCMD="ispell -x "
51+
${SPELLINGCMD} ${notefile}
52+
;;
53+
none)
54+
;;
55+
*)
56+
echo Invalid config option `grep "spellcheck" ${CONFIGFILE}`
57+
esac
58+
}
59+
60+
4261
# initialise notes system
4362
#
4463

@@ -91,6 +110,23 @@ create_config () {
91110
KEY="`gpg -K --with-colons | grep fpr | head -1 | tr -d 'fpr:::::::::' `"
92111
echo "KEY $KEY" > $CONFIGFILE
93112

113+
echo Do you want spellchecking enabled?
114+
echo "1) Use aspell"
115+
echo "2) Use ispell"
116+
echo "3) Do not spellcheck"
117+
read -p "Choose 1,2,or 3: " choosespell
118+
case $choosespell in
119+
1)
120+
echo "spelling=aspell" >> $CONFIGFILE
121+
;;
122+
2)
123+
echo "spelling=ispell" >> $CONFIGFILE
124+
;;
125+
*)
126+
echo "spelling=none" >> $CONFIGFILE
127+
;;
128+
esac
129+
94130
echo Default config written:
95131
cat $CONFIGFILE
96132
}
@@ -165,7 +201,7 @@ note_add () {
165201
# create temporary note file
166202
$EDITOR "$notefile"
167203

168-
#aspell -c "$notefile"
204+
spellcheck
169205

170206
# encrypt note file
171207
$GPG -ear $KEY $GPG_OPTS "$notefile"
@@ -213,11 +249,13 @@ note_edit () {
213249
if [ -f "$notefile" ]; then
214250
gpg -d -o "${decrypted}" "${notefile}"
215251
${EDITOR} "${decrypted}"
252+
spellcheck
216253
$GPG -ear $KEY $GPG_OPTS "${decrypted}"
217254
${SHREDCMD} ${decrypted}
218255
elif [ -f "${notefile}.asc" ]; then
219256
gpg -d -o "${decrypted}" "${notefile}.asc"
220257
${EDITOR} "${decrypted}"
258+
spellcheck
221259
$GPG -ear $KEY $GPG_OPTS "${decrypted}"
222260
${SHREDCMD} ${decrypted}
223261
else
@@ -371,7 +409,7 @@ GPG encrypted notes system for BSD and Linux systems
371409
372410
notes init initialise notes system
373411
notes config display config file
374-
notes backup backup $NOTESDIR to GPG encrypted tar file
412+
notes backup backup $NOTESDIR to GPG encrypted tar file
375413
notes newkey email change GPG key
376414
notes help show help
377415
notes version show version

0 commit comments

Comments
 (0)