allows to search with id
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
return function(query)
|
||||
results_table = {}
|
||||
local skip_regular = false
|
||||
for _, v in pairs(arg) do
|
||||
if v == "-i" or v == "--id" then
|
||||
skip_regular = true
|
||||
local id = tonumber(query)
|
||||
if words[id] then
|
||||
local word = {id,words[id]}
|
||||
table.insert(results_table,word)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
for i=1, #words do
|
||||
if skip_regular then break end
|
||||
local exit = true
|
||||
local all = true
|
||||
for _, v in pairs(arg) do
|
||||
@@ -39,6 +52,10 @@ return function(query)
|
||||
results_table = adjustTableSizes(results_table)
|
||||
printOutputTable(results_table)
|
||||
else
|
||||
print("no words found for <" .. query .. ">")
|
||||
if skip_regular then
|
||||
print("no word found for id #" .. query)
|
||||
else
|
||||
print("no words found for query <" .. query .. ">")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user