Skip to content

Support command options in dynamic exec calls - #237

Merged
Mike Krüger (mkrueger) merged 3 commits into
mainfrom
dev/mkrueger/fix/exec-option-forwarding
Oct 8, 2026
Merged

Mike Krüger (mkrueger) merged 3 commits into
mainfrom
dev/mkrueger/fix/exec-option-forwarding

Conversation

@mkrueger

Copy link
Copy Markdown
Collaborator

Summary

  • Share argument parsing between direct commands and exec, supporting short/long options, equals/colon/space-separated values, quotes, variables, and computed values.
  • Preserve built-in metadata binding, help, and invalid-option errors.
  • Evaluate option-shaped arguments as positional text for functions and scripts, including direct calls and command expressions, without losing scope restoration.
  • Preserve options and quoted arguments when formatting exec statements.
  • Add regression coverage and update programming, command, README, and changelog documentation.

Validation

  • 1470 focused parser, scripting, scope, binding, and LSP tests passed.
  • App and test projects build with zero warnings/errors.
  • CLI exec of echo --help now succeeds and returns echo help.
  • git diff --check passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-code-quality

github-code-quality Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall line coverage in commit 3af5e79 in the dev/mkrueger/fix/exe... branch remains at 66%, unchanged from commit 3a8eb87 in the main branch.

Show a line coverage summary of the most impacted files.
File main 3a8eb87 dev/mkrueger/fix/exe... 3af5e79 +/-
D:\a\CosmosDBSh...entFormatter.cs 100% 100% 0%
D:\a\CosmosDBSh...ommandOption.cs 94% 96% +2%
D:\a\CosmosDBSh...xecStatement.cs 79% 89% +10%

Updated October 07, 2026 12:27 UTC

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Command expressions can silently alter malformed options with missing inline values.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Extends dynamic exec calls to use the shell’s existing command-argument syntax.

Changes:

  • Shares option and shell-word parsing between direct commands and exec.
  • Evaluates option-shaped arguments as positional text for functions and scripts.
  • Preserves argument formatting and adds regression tests and documentation.
File Description
README.md Summarizes dynamic argument support.
docs/​programming.md Documents exec parsing and evaluation.
docs/​commands.md Adds option syntax and an example.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Parser/​StatementParser.cs Shares command-argument parsing.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Parser/​Statement/​ExecStatement.cs Preserves options and quoted arguments when formatting.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Parser/​Statement/​CommandOption.cs Evaluates options as positional text.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Parser/​CommandArgumentFormatter.cs Extracts option-name formatting.
CosmosDBShell.Tests/​Parser/​StatementParserEdgeTests.cs Tests boundaries, missing values, and formatting.
CosmosDBShell.Tests/​Parser/​CommandExecutionTests.cs Tests binding, positional arguments, and scope restoration.
CHANGELOG.md Records the argument-parsing fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:03
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The changes are focused, include targeted regression coverage, and have no unresolved blocking findings.

Review effort: Balanced
Findings: None

Resolved since last review (1)

Resolve PR #237 conflicts by sharing command argument parsing and preserving both regression suites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 12:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The changes are focused, include targeted regression coverage, and have no unresolved blocking issues.

Review effort: Balanced
Findings: None

@mkrueger
Mike Krüger (mkrueger) enabled auto-merge (squash) October 8, 2026 12:31
@mkrueger
Mike Krüger (mkrueger) merged commit 3a9dc25 into main Oct 8, 2026
12 checks passed
@mkrueger
Mike Krüger (mkrueger) deleted the dev/mkrueger/fix/exec-option-forwarding branch October 8, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants