features icon indicating copy to clipboard operation
features copied to clipboard

Pass parent options to a feature it dependsOn

Open j2udev opened this issue 11 months ago • 1 comments

Is there a way to pass options from a wrapping feature to a feature it depends on? For example:

{
  "name": "Go IDE",
  "id": "go-ide",
  "version": "0.1.0",
  "description": "Install a Go IDE",
  "options": {
    "go_version": {
        "type": "string",
        "proposals": [
          "1.23.6"
        ],
        "default": "1.23.6",
        "description": "Select a Go version"
    }
  }
  "customizations": {
    "vscode": {
      "settings": {},
      "extensions": ["golang.go"]
    }
  },
  "dependsOn": {
    "path/to/registry/features/go:0": {
      "version": "<can I reference the `go_version` option from above?>"
    }
  }
}

j2udev avatar Feb 05 '25 15:02 j2udev

Hi @j2udev , you cannot directly reference an option like go_version from a wrapping feature and pass it to a dependent feature automatically. However, you can work around this by leveraging environment variables, postCreateCommand, or scripts to set values dynamically.

sireeshajonnalagadda avatar Feb 21 '25 06:02 sireeshajonnalagadda