mirror of
https://github.com/Jous99/F4MP.git
synced 2026-01-12 17:30:53 +01:00
39 lines
No EOL
810 B
Lua
39 lines
No EOL
810 B
Lua
|
|
function main (target)
|
|
local host = os.host()
|
|
local subhost = os.subhost()
|
|
|
|
local system
|
|
if (host ~= subhost) then
|
|
system = host .. "/" .. subhost
|
|
else
|
|
system = host
|
|
end
|
|
|
|
local branch = "unknown-branch"
|
|
local commit = "unknown-commit"
|
|
local timestamp = ""
|
|
try
|
|
{
|
|
function ()
|
|
import("detect.tools.find_git")
|
|
local git = find_git()
|
|
if (git) then
|
|
branch = os.iorunv(git, {"rev-parse", "--abbrev-ref", "HEAD"}):trim()
|
|
commit = os.iorunv(git, {"rev-parse", "--short", "HEAD"}):trim()
|
|
timestamp = os.iorunv(git, {"log", "-1", "--date=short", "--pretty=format:%ci"}):trim()
|
|
else
|
|
error("git not found")
|
|
end
|
|
end,
|
|
|
|
catch
|
|
{
|
|
function (err)
|
|
print(string.format("Failed to retrieve git data: %s", err))
|
|
end
|
|
}
|
|
}
|
|
|
|
return branch, commit, timestamp
|
|
end |