Generate .setup_info
file with ease
A command-line tool that generates system information by executing shell commands from a JSON template and outputs the results in a format compatible with GitHub Actions.
go install github.com/cirruslabs/setup-info-generator@latest
The tool reads a JSON template from standard input and writes the processed output to standard output. The input template should contain groups of commands to execute, and the output will contain the results of these commands.
The input should be a JSON array of groups, where each group contains a name and a list of commands to execute:
[
{
"group": "OS Detail",
"detail": [
{
"name": "OS Information",
"script": "echo \"macOS $(sw_vers --productVersion) ($(sw_vers --buildVersion))\""
},
{
"name": "Build Date",
"script": "date +\"%Y-%m-%d\""
}
]
}
]
The output will be a JSON array of groups, where each group contains a name and a string with the combined output of all commands:
[
{
"group": "OS Detail",
"detail": "OS Information: macOS 15.1.1 (24B2091)\nBuild Date: 2025-01-07"
}
]
# Using a file
cat template.json | setup-info-generator > output.json
# Using heredoc
setup-info-generator << 'EOF' > output.json
[
{
"group": "System Info",
"detail": [
{
"name": "Hostname",
"script": "hostname"
}
]
}
]
EOF
The tool will exit with a non-zero status code if:
- The input JSON is invalid
- Any script fails to execute
- The output JSON cannot be encoded
Error messages will be written to stderr.