added parameters to limit search to heonian or translation

This commit is contained in:
UndeadMaelys 2022-03-22 21:24:34 +01:00
parent bd15134c3e
commit b8cee98c44
3 changed files with 33 additions and 7 deletions

View File

@ -42,10 +42,12 @@ or arg[1] == "howdo" then
- transcripts the word to heonian script
Parameters:
-h / --help (shows what does the command do)
-a / --all (shows more info on the word, if any)
-v / --verbose (shows the transcription process)
-c / --copy (copies transcription to keyboard)
-e / --english (limits the search to the translated words)
-h / --help (shows what does the command do)
-r / --raw (limits the search to the heonian words)
-v / --verbose (shows the transcription process)
]])
return
end
@ -77,6 +79,8 @@ or arg[1] == "search" then
Parameters:
-h / --help (shows what does the command do)
-a / --all (shows more info on the word, if any)
-e / --english (limits the search to the translated words)
-r / --raw (limits the search to the heonian words)
]])
else
if arg[2] then searchList(arg[2])

View File

@ -1,5 +1,6 @@
return function(tbl)
local show_all = false
for _, v in pairs(arg) do
if v == "-a" or v == "--all" then show_all = true end
end

View File

@ -2,6 +2,26 @@ return function(query)
results_table = {}
for i=1, #words do
local exit = true
local all = true
for _, v in pairs(arg) do
if v == "-r" or v == "--raw" then
all = false
word = string.gsub(words[i][1],"%p","")
if string.find(word, query) then
exit = false
break
end
end
if v == "-e" or v == "--english" then
all = false
word = string.gsub(words[i][2],"%p","")
if string.find(word, query) then
exit = false
break
end
end
end
if all == true then
for j=1, #words[i]-1 do
word = string.gsub(words[i][j],"%p","")
if string.find(word, query) then
@ -9,6 +29,7 @@ return function(query)
break
end
end
end
if not exit then
local word = {i,words[i]}
table.insert(results_table,word)