Skip to content

Feature Request: Support dsc functions in executable args #1722

Description

Summary of the new feature / enhancement

It would be extremely convenient to support functions in the argument list for DSC resources.

Currently the only three ways to pass custom parameters to a process are:

  • environment variables
  • stdin
  • An input argument of { "jsonInputArg": "-json"} or similar.

I would like to propose a 4th option. Strings generated by dsc functions.

This would massively decrease the need for custom programs whose only purpose is to deal with JSON.

Proposed technical implementation details (optional)

  • Support parser.parse_and_execute for each string within an "args" array.
  • Add a jsonInputArg() function to obtain the object representing jsonInputArg.

For example, a custom resource to set a system wide git config variable would look like:

"schema": {
  "embedded": {
    "properties": {
       "key": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
    },
    "required": [
        "key",
        "value"
      ],
      "title": "git_config",
      "type": "object"
  }
}
"set": {
    "executable": "git",
    "args": [
      "config",
      "set",
      "--system",
      "[tryget(jsonInputArg(),'key')]",
      "[tryget(jsonInputArg(),'value')]"
    ]
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions