Class: Librr::CmdParser
Defined Under Namespace
Classes: Daemon
Class Attribute Summary collapse
-
.client ⇒ Object
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/librr/cmd_parser.rb', line 10 def client @client end |
Class Method Details
Instance Method Details
#add(dir) ⇒ Object
40 41 42 43 |
# File 'lib/librr/cmd_parser.rb', line 40 def add(dir) puts "indexing: #{dir}" self.class.client.cmd(:add, dir: File.(dir)) end |
#list ⇒ Object
52 53 54 |
# File 'lib/librr/cmd_parser.rb', line 52 def list puts self.class.client.cmd(:list) end |
#reindex ⇒ Object
57 58 59 |
# File 'lib/librr/cmd_parser.rb', line 57 def reindex self.class.client.cmd(:reindex) end |
#remove(dir) ⇒ Object
46 47 48 49 |
# File 'lib/librr/cmd_parser.rb', line 46 def remove(dir) puts "removing: #{dir}" self.class.client.cmd(:remove, dir: File.(dir)) end |
#search(text) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/librr/cmd_parser.rb', line 65 def search(text) location = (File.([:location]) if [:location]) puts "searching: #{text}" results = self.class.client.cmd(:search, text: text, all: [:all], rows: [:rows], location: location, ) if results.empty? puts "find no result" else puts results.map{|v| v.join(":")} end end |