Greetings = {}
Greetings.greetings_sig = {}
Greetings.greetings_sig["description"] = "shit cli script"
//required args should come first than optional ones
Greetings.greetings_sig["args"] = ["name*", "second_name"]
Greetings.greetings_sig["options"] = [{["-c", "--capitalize"]: "capitalize the names"}, {["-f=", "--from="]: "from name"}]
capitalize = function(s)
s = s.values
s[0] = s[0].upper
return s.join("")
end function
Greetings.greetings = function(args = [], options = {})
name = args[0]
second_name = args[1]
if second_name == null then second_name = ""
from = options["-f="]
if from == null then from = ""
if options["-c"] then
name = capitalize(name)
if second_name != "" then second_name = capitalize(second_name)
if from != "" then from = capitalize(from)
end if
out = ""
if from != "" then out = out + "from " + from + ": "
out = out + ["hello", name, second_name].join(" ")
print(out)
end function
import_code("/home/me/Thorr/libs/listLib.src") //requires on listlib
import_code("/home/me/Thorr/libs/thor.src") //requires on listlib
Thor.init(Greetings, "greetings")