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 - transcripts the word to heonian script
Parameters: Parameters:
-h / --help (shows what does the command do)
-a / --all (shows more info on the word, if any) -a / --all (shows more info on the word, if any)
-v / --verbose (shows the transcription process)
-c / --copy (copies transcription to keyboard) -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 return
end end
@ -77,6 +79,8 @@ or arg[1] == "search" then
Parameters: Parameters:
-h / --help (shows what does the command do) -h / --help (shows what does the command do)
-a / --all (shows more info on the word, if any) -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 else
if arg[2] then searchList(arg[2]) if arg[2] then searchList(arg[2])

View File

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

View File

@ -2,13 +2,34 @@ return function(query)
results_table = {} results_table = {}
for i=1, #words do for i=1, #words do
local exit = true local exit = true
for j=1, #words[i]-1 do local all = true
word = string.gsub(words[i][j],"%p","") for _, v in pairs(arg) do
if string.find(word, query) then if v == "-r" or v == "--raw" then
exit = false all = false
break 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
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
exit = false
break
end
end
end
if not exit then if not exit then
local word = {i,words[i]} local word = {i,words[i]}
table.insert(results_table,word) table.insert(results_table,word)