def 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/def +9 -1
- data/lib/def/version.rb +1 -1
- data/lib/def.rb +12 -0
- metadata +4 -4
data/bin/def
CHANGED
@@ -7,9 +7,17 @@ require 'def'
|
|
7
7
|
|
8
8
|
if ARGV.length == 0
|
9
9
|
puts "Usage: def [word]"
|
10
|
+
puts " --history\tshow history"
|
11
|
+
puts " --clear\tclear history"
|
10
12
|
else
|
11
13
|
dict = Def::Dictionary.new
|
12
14
|
ARGV.each do |arg|
|
13
|
-
|
15
|
+
if arg == '--history'
|
16
|
+
puts dict.history
|
17
|
+
elsif arg == '--clear'
|
18
|
+
dict.clear
|
19
|
+
else
|
20
|
+
puts dict.define(arg)
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
data/lib/def/version.rb
CHANGED
data/lib/def.rb
CHANGED
@@ -27,6 +27,18 @@ module Def
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def history
|
31
|
+
ret = ''
|
32
|
+
@db.query('SELECT w FROM d').each do |w|
|
33
|
+
ret += w[0].to_s + "\n"
|
34
|
+
end
|
35
|
+
ret
|
36
|
+
end
|
37
|
+
|
38
|
+
def clear
|
39
|
+
@db.query('DROP TABLE d')
|
40
|
+
end
|
41
|
+
|
30
42
|
def highlight_word(word, definition)
|
31
43
|
definition.gsub(/(#{word})/i, "\033[0;32m\\1\033[0m")
|
32
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: def
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease: !!null
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire: !!null
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-02-
|
12
|
+
date: 2011-02-12 00:00:00.000000000 -05:00
|
13
13
|
default_executable: !!null
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sqlite3
|
17
|
-
requirement: &
|
17
|
+
requirement: &2153554940 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153554940
|
26
26
|
description: ! "searches dict.org for a definition, and stores results locally\n so
|
27
27
|
subsequent searches will be cached"
|
28
28
|
email:
|