Skip to content

cirruslabs/setup-info-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

setup-info-generator

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.

Installation

go install github.com/cirruslabs/setup-info-generator@latest

Usage

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.

Input Format

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\""
      }
    ]
  }
]

Output Format

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"
  }
]

Example Usage

# 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

Error Handling

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.

About

Generate `.setup_info` file with ease

Resources

License

Stars

Watchers

Forks

Packages

No packages published