ZMK.SCRIPT(5)

πŸ’– ZMK.SCRIPT(5) πŸ’–

okay bestie, so this is the manual page for zmk.Script β€” it's giving template for describing interpreted scripts, and honestly? she's a whole vibe. come sit with me, we're gonna go through it together 🫢


✨ NAME ✨

Script β€” the template for describing interpreted scripts. like, scripts that get interpreted, not compiled. iykyk πŸ’…


🌸 SYNOPSIS 🌸

include z.mk
# scriptName is the name of the script file
$(eval $(call ZMK.Expand,Program,scriptName))

no cap, that's the whole incantation. scriptName is literally just the name of the script file. periodt ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so the Script template, once you expand it with a script name, creates the rules for installing and removing a single script written in an interpreted programming language. one script, one template call, chef's kiss 😌

and β€” plot twist β€” if your script is a shell script, it can be automatically checked with shellcheck, if available. not me being thorough πŸ’€


πŸŽ€ TARGETS πŸŽ€

this module hands you these targets. main character energy, every single one.

πŸ‘‘ install

this phony target copies $(scriptName) over to $(scriptName.InstallDir), using the name $(scriptName.InstallName) and the mode $(scriptName.InstallMode). and if the target directory doesn't exist yet? it just creates it automatically. so helpful, so iconic 🌈

also!! the variables Configure.ProgramPrefix, Configure.ProgramSuffix and Configure.ProgramTransformName automatically impact the installed names of all the scripts. like they just do that. obsessed.

πŸ’€ uninstall

this phony target removes $(scriptName) β€” the exact thing the install target put there. reverse uno card 🫢

🧚 static-check-shellcheck

this phony target uses shellcheck to perform static analysis of compatible scripts. only the compatible ones though, bestie. she's not gonna waste her time πŸ™ˆ

⭐ static-check

this phony target depends on the target static-check-shellcheck. that's it. that's the whole job. queen of delegation πŸ’…


πŸ’œ VARIABLES πŸ’œ

this module provides these variables. get comfy.

🌸 $(scriptName).Interpreter

the name of the script interpreter.

the default value is inferred from the extension of the file name. so she's reading the room, basically. πŸ”₯

πŸŽ€ $(scriptName).InstallDir

the directory $(scriptName) is installed to.

the default value is $(bindir). and here's the spicy bit: the special value noinst disables the rules related to installation and uninstallation. so if you set noinst, install and uninstall just… don't happen. periodt.

πŸ¦‹ $(scriptName).InstallName

the name of the script after installation. glow-up name, if you will.

the default value is $(scriptName). so if you don't say anything, she keeps her government name ✨

πŸ‘‘ $(scriptName).InstallMode

the UNIX mode $(scriptName) is installed with.

the default value is 0755. so yeah, she's executable, as she should be πŸ’…

🌈 DESTDIR

path added to all installation targets.

this variable is normally set externally β€” specifically to install a compiled program into a staging area during construction of a compiled binary package. so it's like, the "where am i actually putting this right now" variable. iykyk 🫢


🧚 IMPLEMENTATION NOTES 🧚

Script uses InstallUninstall to handle installation and removal. that's the whole note. she said "reuse, don't reinvent" πŸ’–


πŸ“œ HISTORY πŸ“œ

the Script template first appeared in zmk 0.1. so she's been here from the beginning, a true OG 🌟


πŸ’– AUTHORS πŸ’–

Zygmunt Krynicki <me@zygoon.pl> β€” the legend herself 🫢


and that's the whole page, bestie!! this one is from zmk 0.5.1, dated May 3, 2020, and the page is zmk.Script(5). go forth and install your scripts, you absolute icon πŸ‘‘βœ¨πŸ’