Functions inside command scripts #24
Labels
documentation
Improvements or additions to documentation.
feature
Something new.
question
Further information is requested / general question.
Milestone
Description
As mentioned in the wiki (https://github.com/krieselreihe/litr/wiki/Quick-Setup#parameter-functions) parameter values can be manipulated via a set of functions (e.g.
camel_case
). This issue shall serve to explore how this will be implemented, as well as what functions should be built-in.Ideas
Base
Basic set of built-in functions are:
case_pascal
- Transform the value to PascalCasecase_camel
- Transform the value to camelCasecase_snake
- Transform the value to snake_casecase_kebab
- Transform the value to kebab-caseThe way they are written is to give them context (
case_*
). Not final.There could also be a
lua
/run
function to execute a Lua file through Litrs Lua version, this could be Lua'sdofile
function e.g.:Extend
It could be possible for users to define more of those functions via a scripting language (e.g. Lua). Some ideas to this:
Example
There can be one or more Lua files containing functions. All function names will be exposed as Litr script functions.
Configure this as global option inside Litr config file. The function name will then be available through the user module
usr
, marking it a user defined function (this will avoid a clash with built-in functions or changes to those in the future).Utilising direnv and
LUA_INIT
could give the user support for own Lua modules.The text was updated successfully, but these errors were encountered: