// options ending with = require a value to be passed after the option
Mycli.commands.hello_sig = {}
Mycli.commands.hello_sig["description"] = "it says hello to you"
Mycli.commands.hello_sig["args"] = [{"name*": "first name"}, {"second_name": "second name (optional)"}]
Mycli.commands.hello_sig["options"] = [{["-c", "--capitalize"]: "will capitalize your name"}, {["-f=", "--from="]: "name from the person saying hello"}]
// options that are not passed will be set to null, also if they are passed all the keys will be set to the options value
// if the functions is called with --help or -h then it wont be called and the documentation will be printed istead
Mycli.main_sig["options"] = [{"-d": "dez"}, {["-c", "--capitalize"]: "will capitalize your name"}, {["-f=", "--from="]: "name from the person saying hello"}]
// the main fuction is the root function of the cli script
// this function will allways be called if the the required args are passed(and they are valid)
// so in this case bc we have another class as args this function will be called first
// then the matching command will be called after
Mycli.main = function(args = {}, options = {})
Mycli.main = function(args = [], options = {})
globals["email"] = email
end function
// functions starting with __ wont trigger the main function
Mycli.__version = function()
print("0.0.1")
end function
import_code("/home/me/thor/libs/listLib.src") //requires on listlib
import_code("/home/me/thor/libs/thor.src") //requires on listlib
Thor.init(Mycli)
libs/thor.src
Thor = {}
Thor.init = function(class, root = true)
self.class = null
self.main = null
self.__commands = {}
self.commands = {}
self.root = root
self.class = class
if self.class.hasIndex("main") then self.main = self.to_command("main")