Skip to content
Hanan edited this page Nov 12, 2024 · 7 revisions

Warning

Documentation out of date. Will have to complete and change it.

What is the purpose of this wiki?

The purpose of this page is to act as a guide for scripting and using various lua functions provided by the slightly modified built in Lua runtime provided by the catalyst executable.


Note

Any variables defined are gone the next time said hook is ran. That's because Catalyst creates a new Lua runtime everytime the executable is launched. Then discards said runtime when it is closed. But this doesn't mean that variables cannot be accessed by different hooks. Because the runtime is started on startup, catalyst uses the same runtime to execute all the other hooks.

Hooks

Hooks are basically Lua scripts named differently maybe to avoid paying any royalties or maybe to just sound cool. They are files in the .catalyst directory and have the .cly extension. A hook is executed when specified in the config.cly.json file and will not execute if not specified in the config (that might change...).

Logging

Logging is really helpful in debugging. Which is why catalyst provides some functions for debugging purposes. Catalyst already has a logger built in, so it leverages that to provide logging to hooks. The logging functions take an input which must be text or displayable as text, and log it in the log files generated by Catalyst and even in the STDOUT, provided you ran Catalyst with the verbose (-v) flag.

The syntax is:

info("Hello, world!")
warn("warning")
error("Error")
debug("debug")

Environment variables

Catalyst has some functions built in for creating or editing environment variables. Those functions are:

getenv("key")

and

setenv("key", "value")

getenv Gets the environment variable specified and returns the value and setenv sets a variable with the specified value in the current environment for later retrieval.

Git functions

Catalyst integrated some git functions, Although the git binary is not necessary, because the library that i use implements all of the actions without using the git binary. Although i will need to add more functions, here are some basic ones:

clonerepo("your_repo_url")

and

submodulesinit()

Warning

The rest of the page is still under construction.

Clone this wiki locally