changed how handle help and added abreviations

This commit is contained in:
UndeadMaelys 2022-03-22 18:06:01 +01:00
parent 31bdc665b3
commit c9ca082f44

81
lexicon
View File

@ -2,39 +2,6 @@
if not arg[1] then print("no argument, try again") return end
for _, v in pairs(arg) do
if v == "-h"
or v == "--help"
or v == "--usage"
or v == "--howdo"
or v == "--how"
or arg[1] == "help"
or arg[1] == "how"
or arg[1] == "howdo"
then please_help = true end
end
--USAGE COMMANDS
if please_help then
if arg[1] == "all"
or arg[1] == "a" then
print("all\n\tshows all words in heonian")
return
end
if arg[1] == "search"
or arg[1] == "s" then
print("search <query>\n\tsearches all words and shows only those that return to string.find()")
return
end
if arg[1] == "transcript"
or arg[1] == "tr" then
print("transcript <word>\n\ttranscripts the word to heonian script")
return
end
print("all\n\tshows all words in heonian\nsearch <query>\n\tsearches all words and shows only those that return to string.find()\ntranscript <word>\n\ttranscripts the word to heonian script")
return
end
require "R2H2"
require "color"
@ -46,17 +13,55 @@ searchList = require "search_list"
words = dofile("words.lua")
if arg[1] == "all" then
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([[all
shows all words in heonian.
search <query>
searches all words and shows only those that return to string.find()
transcript <word>
transcripts the word to heonian script
]])
return
end
if arg[1] == "a"
or arg[1] == "all" then
if please_help then
print("all\n\tshows all words in heonian")
else
showList()
end
return
end
if arg[1] == "search" then
if arg[1] == "s"
or arg[1] == "search" then
if please_help then
print("all\n\tshows all words in heonian")
else
if arg[2] then searchList(arg[2])
else print("insert query") end
else print("no query to search") end
end
return
end
if arg[1] == "transcript" then
if arg[1] == "tr"
or arg[1] == "transcript" then
if please_help then
print("all\n\tshows all words in heonian")
else
if arg[2] then print(convertToHeonian(arg[2]))
else print("no string found") end
else print("no string to transcript") end
return
end
end