public override void Run(string[] args, CancellationToken ct) { VersionWriter.Write(_output, _fuse.Version); Application.Initialize(args); var remainingArgs = _options.Parse(args).ToArray(); var packageName = remainingArgs.TryGetAt(0).OrThrow(new ExitWithError("Fuse install requires a valid component name. See 'fuse help install' for details.")); var component = _componentInstallers.Components.First(c => c.Name == packageName); try { switch (_mode) { case InstallMode.Install: { using (_output.PushColor(ConsoleColor.Yellow)) _output.WriteLine("Starting " + component.Name + " installer"); component.Install(); using (_output.PushColor(ConsoleColor.Yellow)) _output.WriteLine("Done installing " + component.Name); } break; case InstallMode.CheckStatus: if (component.Status == ComponentStatus.Installed) { using (_output.PushColor(ConsoleColor.Green)) _output.WriteLine(packageName + " is installed."); } else if (component.Status == ComponentStatus.UpdateAvailable) { throw new ExitWithError("An update is available to " + packageName, (byte)ComponentStatus.UpdateAvailable); } else { throw new ExitWithError(packageName + " is not installed.", (byte)ComponentStatus.NotInstalled); } break; } } catch (PluginInstallerFailed e) { throw new ExitWithError(e.Message); } }
void RunInternal(string[] args) { try { VersionWriter.Write(_textWriter, _fuse.Version); var parsedArgs = _optionSet.Parse(args); var previewArgs = _argumentResolver .Resolve(parsedArgs) .With( target: _previewTarget, buildTag: _buildTag, isVerboseBuild: _isVerboseBuild, buildLibraries: _buildLibraries, printUnoConfig: _printUnoConfig); if (_fuse.IsInstalled && new Shell().IsInsideRepo(previewArgs.Project.ContainingDirectory)) { _fuse.Report.Warn("Previewing a project inside the Fuse repository with an installed Fuse will lead to unexpected results, due to how .unoconfigs are resolved.", ReportTo.LogAndUser); } if (_endPoint.HasValue) { previewArgs = previewArgs.With(endpoints: ImmutableHashSet.Create(_endPoint.Value)); } _preview.Preview(previewArgs); } catch (InvalidPath e) { throw new ExitWithError( "The specified path '" + e.Path + "' is invalid" + (e.InnerException != null ? ": " + e.InnerException.Message : "")); } catch (DaemonException e) { throw new ExitWithError(e.Message); } catch (FailedToCreateUniqueDirectory e) { throw new ExitWithError(e.Message); } catch (FailedToCreateOutputDir e) { throw new ExitWithError(e.Message); } catch (BuildFailed) { throw new ExitWithError("Failed to compile project"); } catch (ProjectNotFound) { throw new ExitWithError("Could not find a fuse project to preview"); } catch (UnknownPreviewTarget e) { throw new ExitWithError( "Unknown preview target " + e.Target + ". Please run 'fuse help preview' for all available targets"); } catch (FileNotFoundException) { throw new ExitWithError("Could not find the file specified"); } catch (InvalidEndpointString) { throw new ExitWithError( "Invalid endpoint string, excepted it to be formatted as [Address]:[Port]. For example 127.0.0.1:12124"); } catch (SocketException e) { throw new ExitWithError( "A network error occurred: " + e.Message + "\nPlease check your network setup and try again."); } catch (UnableToResolveHostNameException e) { throw new ExitWithError( "A network error occurred: " + e.Message + "\nPlease check your network setup and try again."); } catch (ExportTargetNotSupported e) { throw new ExitWithError("Previewing of target " + e.ExportTarget + " is not supported on this operating system."); } catch (RunFailed e) { throw new ExitWithError(e.Message); } }
public override void Run(string[] args, CancellationToken ct) { VersionWriter.Write(_coloredConsole, _fuse.Version); _killer.Execute(_coloredConsole); }