public static CleanCommand FromParseResult(ParseResult result, string msbuildPath = null) { var msbuildArgs = new List <string> { "-verbosity:normal" }; result.ShowHelpOrErrorIfAppropriate(); msbuildArgs.AddRange(result.GetValueForArgument(CleanCommandParser.SlnOrProjectArgument) ?? Array.Empty <string>()); msbuildArgs.Add("-target:Clean"); msbuildArgs.AddRange(result.OptionValuesToBeForwarded(CleanCommandParser.GetCommand())); return(new CleanCommand(msbuildArgs, msbuildPath)); }
public static CleanCommand FromArgs(string[] args, string msbuildPath = null) { var msbuildArgs = new List <string> { "-verbosity:normal" }; var parser = Parser.Instance; var result = parser.ParseFrom("dotnet clean", args); result.ShowHelpOrErrorIfAppropriate(); msbuildArgs.AddRange(result.ValueForArgument <IEnumerable <string> >(CleanCommandParser.SlnOrProjectArgument) ?? Array.Empty <string>()); msbuildArgs.Add("-target:Clean"); msbuildArgs.AddRange(result.OptionValuesToBeForwarded(CleanCommandParser.GetCommand())); return(new CleanCommand(msbuildArgs, msbuildPath)); }