public static IProcess Up(DockerComposeArguments upRequest) { var programBuilder = new CliProgramBuilder(); var process = programBuilder.Build(b => { b.AddProgram("docker-compose"); b.AddFlagArgument("-f", upRequest.FullPath); b.AddArgument("up", false); if (upRequest.Build) { b.AddFlag("--build"); } if (upRequest.Daemon) { b.AddFlag("-d"); } b.BuildArgumentsInAddOrder(); b.AddDataReceivedCallback(Print); }); return(process); }
static void Main(string[] args) { var program = new CliProgramBuilder(); var process = program.Build(b => { b.AddProgram("youtube-dl.exe"); b.AddArgument("https://www.youtube.com/watch?v=b8HO6hba9ZE"); b.AddFlagArgument("-o", "C:\\Users\\Adam\\Desktop\\%(title)s.%(ext)s"); b.AddDataReceivedCallback(((o, eventArgs) => Console.WriteLine(eventArgs.Data))); b.AddErrorReceivedCallback((o, eventArgs) => Console.WriteLine(eventArgs.Data)); }); process.Start(); }
public static IProcess Clone(this Clone clone) { var programBuilder = new CliProgramBuilder(); var process = programBuilder.Build(b => { b.AddProgram("git"); b.AddArgument("clone"); b.AddArgument(clone.Remote.Location); b.AddArgument(clone.Local.Location); }); return(process); }
public static IProcess Down(DockerComposeArguments downRequest) { var programBuilder = new CliProgramBuilder(); var process = programBuilder.Build(b => { b.AddProgram("docker-compose"); b.AddFlagArgument("-f", downRequest.FullPath); b.AddArgument("down", false); b.BuildArgumentsInAddOrder(); b.AddDataReceivedCallback(Print); }); return(process); }
private static IProcess ChangeDirGitProcess(string localRepositoryLocation, Action <IBuilderActions> extraAction) { var originalDirectory = Directory.GetCurrentDirectory(); var programBuilder = new CliProgramBuilder(); var process = programBuilder.Build(b => { b.AddProgram("git"); extraAction.Invoke(b); b.AddPreprocessAction(action => Directory.SetCurrentDirectory(localRepositoryLocation)); b.AddPostprocessAction(action => Directory.SetCurrentDirectory(originalDirectory)); }); return(process); }
public IRunnableProcess CreateDownload(IEnumerable <string> links, string location, bool audio, string format = null) { var program = new CliProgramBuilder(); return(program.Build(b => { b.AddProgram("youtube-dl"); foreach (var link in links) { b.AddArgument(link); } b.AddFlagArgument("-o", _pathWrapper.Combine(location, "%(title)s.%(ext)s")); if (audio) { b.AddFlag("-x"); b.AddFlagArgument("--audio-format", format ?? "mp3"); } else { if (format != null) { b.AddFlagArgument("--merge-output-format", format); } } if (_errorCallbacks != null) { foreach (var errorCallback in _errorCallbacks) { b.AddErrorReceivedCallback(errorCallback); } } if (_callbacks == null) { return; } foreach (var callback in _callbacks) { b.AddDataReceivedCallback(callback); } })); }
public IRunnableProcess CreateDownload(IEnumerable <string> links, string location, bool audio, string format = null) { var processes = links.Select(s => { var program = new CliProgramBuilder(); return(program.Build(b => { b.AddProgram("get-iplayer-python"); b.AddArgument(s); b.AddFlagArgument("-l", location); if (format != null) { b.AddFlagArgument("--output-format", format); } if (audio) { b.AddFlag("-a"); } if (_errorCallbacks != null) { foreach (var errorCallback in _errorCallbacks) { b.AddErrorReceivedCallback(errorCallback); } } if (_callbacks == null) { return; } foreach (var callback in _callbacks) { b.AddDataReceivedCallback(callback); } })); }); return(new AggregateRunnableProcess(processes)); }
public static IProcess Super(string fullPath, params string[] arguments) { var programBuilder = new CliProgramBuilder(); var process = programBuilder.Build(b => { b.AddProgram("docker-compose"); b.AddFlagArgument("-f", fullPath); foreach (var argument in arguments) { b.AddArgument(argument, false); } b.BuildArgumentsInAddOrder(); b.AddDataReceivedCallback(Print); }); return(process); }