/// <summary> /// Creates a copy of this command, setting the standard error pipe to the specified target. /// </summary> public Command WithStandardErrorPipe(PipeTarget target) => new Command( TargetFilePath, Arguments, WorkingDirPath, EnvironmentVariables, Validation, StandardInputPipe, StandardOutputPipe, target);
/// <summary> /// Initializes an instance of <see cref="Command"/>. /// </summary> public Command( string targetFilePath, string arguments, string workingDirPath, IReadOnlyDictionary <string, string> environmentVariables, CommandResultValidation validation, PipeSource standardInputPipe, PipeTarget standardOutputPipe, PipeTarget standardErrorPipe) { TargetFilePath = targetFilePath; Arguments = arguments; WorkingDirPath = workingDirPath; EnvironmentVariables = environmentVariables; Validation = validation; StandardInputPipe = standardInputPipe; StandardOutputPipe = standardOutputPipe; StandardErrorPipe = standardErrorPipe; }
/// <summary> /// Creates a new command that pipes its standard output and standard error to the specified streams. /// </summary> public static Command operator |(Command source, ValueTuple <Stream, Stream> target) => source | (PipeTarget.ToStream(target.Item1), PipeTarget.ToStream(target.Item2));
/// <summary> /// Creates a new command that pipes its standard output line-by-line to the specified delegate. /// Uses <see cref="Console.OutputEncoding"/> to decode the byte stream. /// </summary> public static Command operator |(Command source, Func <string, Task> target) => source | PipeTarget.ToDelegate(target);
/// <summary> /// Creates a new command that pipes its standard output line-by-line to the specified delegate. /// Uses <see cref="Console.OutputEncoding"/> to decode the byte stream. /// </summary> public static Command operator |(Command source, Action <string> target) => source | PipeTarget.ToDelegate(target);
/// <summary> /// Creates a new command that pipes its standard output to the specified string builder. /// Uses <see cref="Console.OutputEncoding"/> to decode the byte stream. /// </summary> public static Command operator |(Command source, StringBuilder target) => source | PipeTarget.ToStringBuilder(target);
/// <summary> /// Creates a new command that pipes its standard output to the specified stream. /// </summary> public static Command operator |(Command source, Stream target) => source | PipeTarget.ToStream(target);