owa-rs/modules/owu/cli/run.owa
2026-05-06 12:21:06 +03:00

43 lines
987 B
Text

(seq
(def target (vec.find #(bool.not (str.starts-with? %1 "-")) (vec.reverse args)))
(if (null? target) (seq
(trace "No target specified")
(return)
))
(fn parse-arg [args name] (seq
(def idx (vec.index-of args name))
(if (null? idx)
null
(vec.get args (+ idx 1))
)
))
(def no-builtins? (vec.has args "--no-builtins"))
(def no-core? (vec.has args "--no-core"))
(def no-std? (vec.has args "--no-std"))
(def is-debug? (vec.has args "--debug"))
(def test-target (parse-arg args "--test"))
(exec
{
:__runtime__ :owu
:__dir__ ""
:__main__ target
:__test__ test-target
}
(seq
(unless no-builtins?
(def builtins builtins))
(unless (bool.or no-builtins? no-core?)
(include (str.concat modules-dir "/core")))
(unless (bool.or no-builtins? no-core? no-std?)
(include (str.concat modules-dir "/std")))
(def __is_debug__ is-debug?)
)
target
)
)