Skip to content

Add shell mode to Exec with output-based guards - #22

Merged
TsekNet merged 1 commit into
mainfrom
powershell-extension
Apr 12, 2026
Merged

TsekNet merged 1 commit into
mainfrom
powershell-extension

Conversation

@TsekNet

@TsekNet TsekNet commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Shell, ShellParams, OnlyIfMatch fields to Exec extension
  • Support "auto", "powershell", "pwsh", "cmd", "bash", "sh", custom paths
  • PowerShell commands wrapped with $ErrorActionPreference = 'Stop' and $ProgressPreference = 'SilentlyContinue'
  • OnlyIfMatch enables output-based state detection (trimmed stdout comparison)
  • Add examples.md sitemap and Shell/PowerShell examples

Test plan

  • go build ./... passes (Linux, macOS, Windows)
  • go test -race ./extensions/exec/ passes (30 tests including Shell, OnlyIfMatch, resolveShell)
  • go vet ./... clean

Closes #21

Add Shell, ShellParams, and OnlyIfMatch fields to ExecOpts. Supports
powershell (5.1), pwsh (7+), cmd, bash, sh, auto (platform default),
and custom paths. Multi-line scripts via -Command (never -File).

PowerShell commands are wrapped with $ErrorActionPreference = 'Stop'
and $ProgressPreference = 'SilentlyContinue' to prevent silent cmdlet
failures and progress bar stdout corruption.

OnlyIfMatch enables output-based state detection: guard compares
trimmed stdout against expected string instead of exit code.

Closes #21
@TsekNet
TsekNet merged commit 6ac16d6 into main Apr 12, 2026
1 check passed
@TsekNet
TsekNet deleted the powershell-extension branch April 12, 2026 14:46
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.

Add shell mode to Exec: PowerShell, bash, cmd with output-based guards

1 participant