示例#1
0
        public string Run(List <string> args)
        {
            if (args.Any(a => a == "-h" || a == "--help" || a == "-?" || a == "/?"))
            {
                return(GetHelpMessage());
            }

            if (args.Any(a => a == "-q" || a == "--quiet"))
            {
                _quietMode = true;
                args.RemoveAt(args.FindIndex(a => a == "-q" || a == "--quiet"));
            }

            if (args.Any(a => a == "-u" || a == "--update"))
            {
                _update = true;
                args.RemoveAt(args.FindIndex(a => a == "-u" || a == "--update"));
            }


            var projects = _projectFileManager.GetAllProjects(args);

            if (!projects.Any())
            {
                return("No project files found");
            }

            var msg        = new StringBuilder();
            var allResults = _checker.GetPackages(projects);
            var output     = GetAllResultsTables(allResults);

            msg.AppendLine(output);

            if (_update)
            {
                var updated = _projectFileManager.Update(allResults);
                foreach (var projectFile in updated)
                {
                    msg.AppendLine($"{projectFile} updated");
                }
            }
            return(msg.ToString());
        }