Skip to content

Commit

Permalink
Print out the dictionaries
Browse files Browse the repository at this point in the history
Closes GH-1.
  • Loading branch information
RichardLitt authored and wooorm committed Jul 8, 2017
1 parent ff4c4bc commit 9f212c8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions osx-learn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ cat << EOF
Options:
-h, --help output usage information
-p, --print output dictionary (default LocalDictionary)
-v, --version output version
Examples:
$ learn npm
$ learn stringification en_GB
$ learn --print
npm
$ learn --print en_GB
stringification
See also: man 1 learn
EOF
Expand All @@ -31,13 +36,26 @@ version () {
echo "1.0.0"
}

#
# Print.
#

print () {
readonly lang=${1-"LocalDictionary"}

database=~/Library/Spelling/$lang

cat "$database"
}

#
# Options.
#

case $1 in
"") usage; exit 1 ;;
-h|--help) usage; exit ;;
-p|--print) print $2; exit ;;
-v|--version) version; exit ;;
*) readonly replace=$1 ; readonly lang=${2-"LocalDictionary"} ;;
esac
Expand Down

0 comments on commit 9f212c8

Please sign in to comment.