PowerShell / PowerShell/DSC

CLI parameters and subcommands

Open
#984 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.
Summary

When building and testing commands it is natural to append --trace-level or any other parameter that is for the subcommand or a child of said subcommand. This does not work like other CLI applications. The parameters are only valid in the same order as the command/subcommand.

Take the following command, I ran the command without tracing and now would like to add tracing to the end of the command. This command fails. However if you put it at the very beginning it works.

#fails 
dsc config get -f C:\temp\Test.dsc.yaml --trace-level trace
dsc config get --trace-level trace -f C:\temp\Test.dsc.yaml
dsc config --trace-level trace -f get C:\temp\Test.dsc.yaml

# works
dsc --trace-level trace config -f get C:\temp\Test.dsc.yaml
Steps to reproduce
PS C:\> dsc config get -f C:\temp\Test.dsc.yaml
metadata:
  Microsoft.DSC:
    version: 3.1.0
    operation: get
    executionType: actual
    startDatetime: 2025-07-20T00:18:53.188218700-05:00
    endDatetime: 2025-07-20T00:18:53.381591700-05:00
    duration: PT0.193373S
    securityContext: restricted
results:
- metadata:
    Microsoft.DSC:
      duration: PT0.0206813S
  name: current user registry
  type: Microsoft.Windows/Registry
  result:
    actualState:
      keyPath: HKCU\test
      valueName: pizza
      _exist: false
messages: []
hadErrors: false
PS C:\> dsc config get -f C:\temp\Test.dsc.yaml --trace-level trace
error: unexpected argument '--trace-level' found

Usage: dsc.exe config get --file <FILE>

For more information, try '--help'
Expected behavior
dsc config get -f C:\temp\Test.dsc.yaml --trace-level trace

works
Actual behavior
error: unexpected argument '--trace-level' found

Usage: dsc.exe config get --file <FILE>

For more information, try '--help'
Error details

Environment data
7.5-preview4
Version

3.2-preview2

Visuals

No response

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 by reproducing the dsc config get command with --trace-level after the subcommand, then inspect the CLI argument parsing for dsc config get. Done means the option is accepted after the subcommand and existing command forms continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.