private async Task <string> GetComponentNamesMessageAsync(ITargetScopeService target) { IEnumerable <Envoy> targetEnvoys = target.GetDefaultBuildSpecScope().Envoy.Envoys; IList <string> componentNames = new List <string>(); foreach (Envoy targetEnvoy in targetEnvoys) { if (await IsComponentForDisplayAsync(targetEnvoy)) { componentNames.Add('\t' + targetEnvoy.Name.Last); } } return(string.Join(Environment.NewLine, componentNames)); }
private async Task <Envoy> ResolveComponentOnTargetAsync(string componentName, ITargetScopeService targetScope) { ITargetScopeService targetbuildBuildSpecScope = targetScope.GetDefaultBuildSpecScope(); IEnumerable <Envoy> matchingComponents = await targetbuildBuildSpecScope.TargetScope.ResolveAsync(new QualifiedName(componentName)); if (matchingComponents.HasMoreThan(1)) { throw new CommandLineOperationException("Multiple components matching the provided name were found. This likely indicates a corrupt project file."); } Envoy componentEnvoy = matchingComponents.SingleOrDefault(); if (componentEnvoy == null) { CommandLineInterfaceApplication.WriteError(await CreateResolveComponentErrorMessageAsync(componentName, targetScope.GetScopeDisplayName(), targetScope)); } return(componentEnvoy); }