global-functions: introduce $FileGet

This commit is contained in:
Christian Hesse 2025-06-02 21:53:23 +02:00
parent 4bc3bf40e6
commit b70e6e7984

View file

@ -38,6 +38,7 @@
:global ExitError;
:global FetchHuge;
:global FetchUserAgentStr;
:global FileGet;
:global FormatLine;
:global FormatMultiLines;
:global GetMacVendor;
@ -529,6 +530,18 @@
$Resource->"architecture-name" . " " . $Caller . "/Fetch (https://rsc.eworm.de/)");
}
# get file properties in array, or false on error
:set FileGet do={
:local FileName [ :tostr $1 ];
:local FileVal false;
:do {
:set FileVal [ /file/get $FileName ];
} on-error={ }
:return $FileVal;
}
# format a line for output
:set FormatLine do={
:local Key [ :tostr $1 ];