Example #1
0
        /// <summary>
        /// Standard input redirection as in bash. The given <paramref name="file"/> is written to the <see cref="Command"/>'s
        /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(FileInfo file)
        {
            Throw.IfNull(file, nameof(file));

            return(new IOCommand(this, this.StandardInput.PipeFromAsync(file), StandardIOStream.In, file));
        }
Example #2
0
        /// <summary>
        /// Standard error redirection as in bash. The lines of <see cref="Command"/>'s standard error are added to the given
        /// collection (<paramref name="lines"/> Returns a new <see cref="Command"/>  whose <see cref="Command.Task"/> tracks
        /// the progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(ICollection <string> lines)
        {
            Throw.IfNull(lines, nameof(lines));

            return(new IOCommand(this, this.StandardError.PipeToAsync(lines), StandardIOStream.Error, lines.GetType()));
        }
Example #3
0
 /// <summary>
 /// Standard input redirection as in bash. The items in <paramref name="lines"/> are written to the <see cref="Command"/>'s
 /// standard output as lines of text. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the
 /// progress of both this <see cref="Command"/> and the IO being performed
 /// </summary>
 public static Command operator <(Command command, IEnumerable <string> lines)
 {
     Throw.IfNull(command, "command");
     return(command.RedirectFrom(lines));
 }
Example #4
0
        /// <summary>
        /// Standard output redirection as in bash. The chars of <see cref="Command"/>'s standard output are added to the given
        /// collection (<paramref name="chars"/> Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks
        /// the progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectTo(ICollection <char> chars)
        {
            Throw.IfNull(chars, nameof(chars));

            return(new IoCommand(this, this.StandardOutput.PipeToAsync(chars), ">", chars.GetType()));
        }
Example #5
0
        /// <summary>
        /// Standard input redirection as in bash. The given <paramref name="reader"/> is written to the <see cref="Command"/>'s
        /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(TextReader reader)
        {
            Throw.IfNull(reader, nameof(reader));

            return(new IOCommand(this, this.StandardInput.PipeFromAsync(reader, leaveReaderOpen: true), StandardIOStream.In, reader));
        }
Example #6
0
 /// <summary>
 /// Standard input redirection as in bash. The given <paramref name="stream"/> is written to the <see cref="Command"/>'s
 /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
 /// of both this <see cref="Command"/> and the IO being performed
 /// </summary>
 public static Command operator <(Command command, Stream stream)
 {
     Throw.IfNull(command, "command");
     return(command.RedirectFrom(stream));
 }
Example #7
0
        /// <summary>
        /// Standard output redirection as in bash. The <see cref="Command"/>'s standard output is written to the given
        /// <paramref name="writer"/>. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectTo(TextWriter writer)
        {
            Throw.IfNull(writer, nameof(writer));

            return(new IoCommand(this, this.StandardOutput.PipeToAsync(writer, leaveWriterOpen: true)));
        }
Example #8
0
        /// <summary>
        /// Standard input redirection as in bash. The items in <paramref name="chars"/> are written to the <see cref="Command"/>'s
        /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the
        /// progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(IEnumerable <char> chars)
        {
            Throw.IfNull(chars, nameof(chars));

            return(new IOCommand(this, this.StandardInput.PipeFromAsync(chars), StandardIOStream.In, chars.GetType()));
        }
Example #9
0
        /// <summary>
        /// Standard error redirection as in bash. The chars of <see cref="Command"/>'s standard error are added to the given
        /// collection (<paramref name="chars"/> Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks
        /// the progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(ICollection <char> chars)
        {
            Throw.IfNull(chars, nameof(chars));

            return(new IoCommand(this, this.StandardError.PipeToAsync(chars)));
        }
Example #10
0
        /// <summary>
        /// Standard input redirection as in bash. The items in <paramref name="chars"/> are written to the <see cref="Command"/>'s
        /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the
        /// progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(IEnumerable <char> chars)
        {
            Throw.IfNull(chars, nameof(chars));

            return(new IoCommand(this, this.StandardInput.PipeFromAsync(chars)));
        }
Example #11
0
        /// <summary>
        /// Standard input redirection as in bash. The items in <paramref name="lines"/> are written to the <see cref="Command"/>'s
        /// standard output as lines of text. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the
        /// progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(IEnumerable <string> lines)
        {
            Throw.IfNull(lines, nameof(lines));

            return(new IoCommand(this, this.StandardInput.PipeFromAsync(lines)));
        }
Example #12
0
        /// <summary>
        /// Standard error redirection as in bash. The lines of <see cref="Command"/>'s standard error are added to the given
        /// collection (<paramref name="lines"/> Returns a new <see cref="Command"/>  whose <see cref="Command.Task"/> tracks
        /// the progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(ICollection <string> lines)
        {
            Throw.IfNull(lines, nameof(lines));

            return(new IoCommand(this, this.StandardError.PipeToAsync(lines)));
        }
Example #13
0
        /// <summary>
        /// Standard output redirection as in bash. The <see cref="Command"/>'s standard output is written to the given
        /// <paramref name="stream"/>. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectTo(Stream stream)
        {
            Throw.IfNull(stream, nameof(stream));

            return(new IoCommand(this, this.StandardOutput.PipeToAsync(stream, leaveStreamOpen: true)));
        }
Example #14
0
        /// <summary>
        /// Standard input redirection as in bash. The items in <paramref name="lines"/> are written to the <see cref="Command"/>'s
        /// standard output as lines of text. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the
        /// progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(IEnumerable <string> lines)
        {
            Throw.IfNull(lines, nameof(lines));

            return(new IOCommand(this, this.StandardInput.PipeFromAsync(lines), StandardIOStream.In, lines.GetType()));
        }
Example #15
0
        /// <summary>
        /// Implements <see cref="Command"/> piping as in bash. The first <see cref="Command"/>'s standard output is piped
        /// to the second's standard input. Returns a new <see cref="Command"/> instance whose <see cref="Command.Task"/> tracks
        /// the progress of the entire chain
        /// </summary>
        public Command PipeTo(Command second)
        {
            Throw.IfNull(second, nameof(second));

            return(new PipedCommand(this, second));
        }
Example #16
0
        /// <summary>
        /// Standard error redirection as in bash. The chars of <see cref="Command"/>'s standard error are added to the given
        /// collection (<paramref name="chars"/> Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks
        /// the progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(ICollection <char> chars)
        {
            Throw.IfNull(chars, nameof(chars));

            return(new IOCommand(this, this.StandardError.PipeToAsync(chars), StandardIOStream.Error, chars.GetType()));
        }
Example #17
0
        /// <summary>
        /// Standard error redirection as in bash. The <see cref="Command"/>'s standard error is written to the given
        /// <paramref name="stream"/>. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(Stream stream)
        {
            Throw.IfNull(stream, nameof(stream));

            return(new IOCommand(this, this.StandardError.PipeToAsync(stream, leaveStreamOpen: true), StandardIOStream.Error, stream));
        }
Example #18
0
        /// <summary>
        /// Standard error redirection as in bash. The <see cref="Command"/>'s standard error is written to the given
        /// <paramref name="writer"/>. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(TextWriter writer)
        {
            Throw.IfNull(writer, nameof(writer));

            return(new IOCommand(this, this.StandardError.PipeToAsync(writer, leaveWriterOpen: true), StandardIOStream.Error, writer));
        }
Example #19
0
        /// <summary>
        /// Standard input redirection as in bash. The given <paramref name="stream"/> is written to the <see cref="Command"/>'s
        /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectFrom(Stream stream)
        {
            Throw.IfNull(stream, nameof(stream));

            return(new IOCommand(this, this.StandardInput.PipeFromAsync(stream, leaveStreamOpen: true), StandardIOStream.In, stream));
        }
Example #20
0
 /// <summary>
 /// Implements <see cref="Command"/> piping as in bash. The first <see cref="Command"/>'s standard output is piped
 /// to the second's standard input. Returns a new <see cref="Command"/> instance whose <see cref="Command.Task"/> tracks
 /// the progress of the entire chain
 /// </summary>
 public static Command operator |(Command first, Command second)
 {
     Throw.IfNull(first, "first");
     return(first.PipeTo(second));
 }
Example #21
0
        /// <summary>
        /// Standard output redirection as in bash. The <see cref="Command"/>'s standard output is written to the given
        /// <paramref name="file"/>. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectTo(FileInfo file)
        {
            Throw.IfNull(file, nameof(file));

            return(new IOCommand(this, this.StandardOutput.PipeToAsync(file), StandardIOStream.Out, file));
        }
Example #22
0
 /// <summary>
 /// Standard input redirection as in bash. The given <paramref name="file"/> is written to the <see cref="Command"/>'s
 /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
 /// of both this <see cref="Command"/> and the IO being performed
 /// </summary>
 public static Command operator <(Command command, FileInfo file)
 {
     Throw.IfNull(command, "command");
     return(command.RedirectFrom(file));
 }
Example #23
0
        /// <summary>
        /// Standard error redirection as in bash. The <see cref="Command"/>'s standard error is written to the given
        /// <paramref name="file"/>. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the progress
        /// of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectStandardErrorTo(FileInfo file)
        {
            Throw.IfNull(file, nameof(file));

            return(new IOCommand(this, this.StandardError.PipeToAsync(file), StandardIOStream.Error, file));
        }
Example #24
0
 /// <summary>
 /// Standard input redirection as in bash. The items in <paramref name="chars"/> are written to the <see cref="Command"/>'s
 /// standard output. Returns a new <see cref="Command"/> whose <see cref="Command.Task"/> tracks the
 /// progress of both this <see cref="Command"/> and the IO being performed
 /// </summary>
 public static Command operator <(Command command, IEnumerable <char> chars)
 {
     Throw.IfNull(command, "command");
     return(command.RedirectFrom(chars));
 }
Example #25
0
        /// <summary>
        /// Standard output redirection as in bash. The lines of <see cref="Command"/>'s standard output are added to the given
        /// collection (<paramref name="lines"/> Returns a new <see cref="Command"/>  whose <see cref="Command.Task"/> tracks
        /// the progress of both this <see cref="Command"/> and the IO being performed
        /// </summary>
        public Command RedirectTo(ICollection <string> lines)
        {
            Throw.IfNull(lines, nameof(lines));

            return(new IoCommand(this, this.StandardOutput.PipeToAsync(lines), ">", lines.GetType()));
        }