3a17d3b9fd
Resolve #1691 by preserving argv boundaries, adding bounded native rg and wc/skill query support, surfacing WSL-to-Windows hints, and splitting the oversized SSH module and embedded remote scripts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
14 lines
823 B
PowerShell
14 lines
823 B
PowerShell
if ($operation -eq 'cat') {
|
|
$maxBytes = 262144; $paths = [Collections.Generic.List[string]]::new()
|
|
for ($i = 0; $i -lt $toolArgs.Count; $i++) {
|
|
$arg = $toolArgs[$i]
|
|
if ($arg -eq '--max-bytes') { $i += 1; if ($i -ge $toolArgs.Count) { Fail '--max-bytes requires a value' 2 }; $maxBytes = Parse-NonNegativeInt '--max-bytes' $toolArgs[$i] 16777216; continue }
|
|
if ($arg.StartsWith('--max-bytes=')) { $maxBytes = Parse-NonNegativeInt '--max-bytes' $arg.Substring(12) 16777216; continue }
|
|
if ($arg.StartsWith('-') -and $arg -ne '-') { Fail ('unsupported cat option on Windows route: ' + $arg) 2 }
|
|
$paths.Add($arg)
|
|
}
|
|
if ($paths.Count -ne 1) { Fail 'cat requires exactly one file path on Windows routes' 2 }
|
|
[Console]::Out.Write((Read-StrictText (Resolve-UnideskPath $paths[0]) $maxBytes))
|
|
exit 0
|
|
}
|