MCPcopy Index your code
hub / github.com/anomalyco/opencode / powershellNotes

Function powershellNotes

packages/opencode/src/tool/shell/prompt.ts:43–63  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

41}
42
43function powershellNotes(name: string) {
44 if (name === "pwsh") {
45 return `# PowerShell (7+) shell notes
46- This cross-platform shell supports pipeline chain operators (\`&&\` and \`||\`).
47- Use double quotes for interpolated strings (\`"Hello $name"\`), single quotes for verbatim strings.
48- Prefer full cmdlet names like \`Get-ChildItem\`, \`Set-Content\`, \`Remove-Item\`, and \`New-Item\` over aliases.
49- Use \`$(...)\` for subexpressions. Use \`@(...)\` for array expressions.
50- To call a native executable whose path contains spaces, use the call operator: \`& "path/to/exe" args\`.
51- Escape special characters with the PowerShell backtick character.`
52 }
53 if (name === "powershell") {
54 return `# Windows PowerShell (5.1) shell notes
55- Use \`cmd1; if ($?) { cmd2 }\` to chain dependent commands.
56- Use double quotes for interpolated strings (\`"Hello $name"\`), single quotes for verbatim strings.
57- Prefer full cmdlet names like \`Get-ChildItem\`, \`Set-Content\`, \`Remove-Item\`, and \`New-Item\` over aliases.
58- Use \`$(...)\` for subexpressions. Use \`@(...)\` for array expressions.
59- To call a native executable whose path contains spaces, use the call operator: \`& "path/to/exe" args\`.
60- Escape special characters with the PowerShell backtick character.`
61 }
62 return ""
63}
64
65function chainGuidance(name: string) {
66 if (name === "powershell") {

Callers 1

powershellCommandSectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected