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 }