conlang-heonian/lexicon

110 lines
2.2 KiB
Lua
Executable File

#!/usr/bin/env lua
if not arg[1] then print("no argument, try again") return end
require "R2H2"
require "color"
adjustTableSizes = require "output_sizes"
printOutputTable = require "output_word"
showList = require "show_list"
searchList = require "search_list"
words = dofile("words.lua")
for _, v in pairs(arg) do
if v == "-h"
or v == "--help"
or v == "--usage"
or v == "--how"
then
please_help = true
end
end
if arg[1] == "h"
or arg[1] == "help"
or arg[1] == "how"
or arg[1] == "howdo" then
print([[
[a]ll
- shows all words in heonian.
[h]elp
- shows this message
[s]earch <query>
- searches all words and shows only those that return to string.find()
[tr]anscript <word>
- transcripts the word to heonian script
Parameters:
-a / --all (shows more info on the word, if any)
-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
if arg[1] == "a"
or arg[1] == "all" then
if please_help then
print([[
[a]ll
- shows all words in heonian.
Parameters:
-h / --help (shows what does the command do)
-a / --all (shows more info on the word, if any)
]])
else
showList()
end
return
end
if arg[1] == "s"
or arg[1] == "search" then
if please_help then
print([[
[s]earch <query>
- searches all words and shows only those that return to string.find()
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])
else print("no query to search") end
end
return
end
if arg[1] == "tr"
or arg[1] == "transcript" then
if please_help then
print([[
[tr]anscript <word>
- transcripts the word to heonian script
Parameters:
-h / --help (shows what does the command do)
-v / --verbose (shows the transcription process)
-c / --copy (copies transcription to keyboard)
]])
else
if arg[2] then print(convertToHeonian(arg[2]))
else print("no string to transcript") end
return
end
end