public DependencyListOptions(Reports reports, CommandArgument path, CommandOption framework) { bool isInputValid = true; // reports Reports = reports; // project var projectPath = path.Value ?? Directory.GetCurrentDirectory(); Runtime.Project projectOption; isInputValid &= Runtime.Project.TryGetProject(projectPath, out projectOption); Path = projectPath; Project = projectOption; // framework if (framework.HasValue()) { try { Framework = VersionUtility.ParseFrameworkName(framework.Value()); } catch (ArgumentException ex) { Reports.Error.WriteLine("Invalid framework name: {0}. [{1}]", framework.Value(), ex.Message); isInputValid = false; } } else { Framework = null; } Valid = isInputValid; }
public DependencyListOptions(Reports reports, CommandArgument path) { bool isInputValid = true; // reports Reports = reports; // project var projectPath = path.Value ?? Directory.GetCurrentDirectory(); Runtime.Project projectOption; isInputValid &= Runtime.Project.TryGetProject(projectPath, out projectOption); Path = projectPath; Project = projectOption; Valid = isInputValid; }
public CommandArgument Argument(string name, string description, Action<CommandArgument> configuration) { var argument = new CommandArgument { Name = name, Description = description }; Arguments.Add(argument); configuration(argument); return argument; }