public override void ExecuteCommand() { if (string.IsNullOrEmpty(Pivots)) { // if they didn't specify any pivot keywords, just install the package they asked for. base.ExecuteCommand(); return; } // otherwise, they have specified at least one pivot, and therefore we should just grab the pivot list // and install everything that we completely match in the pivot list. var pivotListPath = Path.Combine(OverlayPackageDirectory, @"build\native\pivot-list.txt"); if (!File.Exists(pivotListPath)) { throw new Exception(string.Format("Can't fine pivot list at '{0}'", pivotListPath)); } var allPivots = File.ReadAllLines(pivotListPath); IEnumerable <string> keywords = Pivots.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); if (this.Arguments.Count > 0) { keywords = keywords.Union(this.Arguments); } keywords = keywords.Select(each => each.ToLower()).ToArray(); IEnumerable <string> selectedPivots = keywords.All(each => each == "all") ? allPivots : (from p in allPivots let piv = p.ToLower() where keywords.All(piv.Contains) select p); // just looking? if (List) { this.Console.WriteLine("Overlay packages found:"); foreach (var overlayPivot in selectedPivots) { this.Console.WriteLine(" {0}", overlayPivot); } return; } // otherwise, just install each one. Pivots = null; foreach (var overlayPivot in selectedPivots) { try { Arguments.Clear(); Arguments.Add(overlayPivot); ExecuteCommand(); } catch (Exception e) { Console.WriteLine("{0}/{1}/{2}", e.GetType().Name, e.Message, e.StackTrace); } } }