PowerShell / PowerShell/DSC

Feature Request: Support dsc functions in executable args

Open
#1,722 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Enhancement
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the executable argument handling and the parser.parse_and_execute path mentioned in the issue. Trace how each string in an args array is processed, then implement and verify function evaluation there, including jsonInputArg() returning the jsonInputArg object so the example arguments produce the expected values.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.