Exemplo n.º 1
0
        public static void Register(CommandLineApplication cmdApp, ReportsFactory reportsFactory, IApplicationEnvironment appEnvironment)
        {
            cmdApp.Command("list", c =>
            {
                c.Description = "Print the dependencies of a given project";
                var showAssemblies = c.Option("-a|--assemblies",
                    "Show the assembly files that are depended on by given project",
                    CommandOptionType.NoValue);
                var frameworks = c.Option("--framework <TARGET_FRAMEWORK>",
                    "Show dependencies for only the given frameworks",
                    CommandOptionType.MultipleValue);
                var runtimeFolder = c.Option("--runtime <PATH>",
                    "The folder containing all available framework assemblies",
                    CommandOptionType.SingleValue);
                var details = c.Option("--details",
                    "Show the details of how each dependency is introduced",
                    CommandOptionType.NoValue);
                var mismatched = c.Option("--mismatched",
                    "Show the mismatch dependencies.",
                    CommandOptionType.NoValue);
                var resultsFilter = c.Option("--filter <PATTERN>",
                    "Filter the libraries referenced by the project base on their names. The matching pattern supports * and ?",
                    CommandOptionType.SingleValue);
                var argProject = c.Argument("[project]", "Path to project, default is current directory");
                c.HelpOption("-?|-h|--help");

                c.OnExecute(() =>
                {
                    c.ShowRootCommandFullNameAndVersion();

                    var options = new DependencyListOptions(reportsFactory.CreateReports(verbose: true, quiet: false), argProject)
                    {
                        ShowAssemblies = showAssemblies.HasValue(),
                        RuntimeFolder = runtimeFolder.Value(),
                        Details = details.HasValue(),
                        ResultsFilter = resultsFilter.Value(),
                        Mismatched = mismatched.HasValue()
                    };
                    options.AddFrameworkMonikers(frameworks.Values);

                    if (!options.Valid)
                    {
                        if (options.Project == null)
                        {
                            options.Reports.Error.WriteLine(string.Format("Unable to locate {0}.".Red(), Runtime.Project.ProjectFileName));
                            return 1;
                        }
                        else
                        {
                            options.Reports.Error.WriteLine("Invalid options.".Red());
                            return 2;
                        }
                    }

                    var command = new DependencyListCommand(options, appEnvironment.RuntimeFramework);
                    return command.Execute();
                });
            });
        }
Exemplo n.º 2
0
 public DependencyListCommand(DependencyListOptions options, FrameworkName fallbackFramewok)
 {
     _options = options;
     _fallbackFramework = fallbackFramewok;
 }
Exemplo n.º 3
0
 public DependencyListCommand(DependencyListOptions options, FrameworkName fallbackFramewok)
 {
     _options           = options;
     _fallbackFramework = fallbackFramewok;
 }
Exemplo n.º 4
0
 public DependencyListOperation(DependencyListOptions options, FrameworkName framework)
 {
     _options     = options;
     _framework   = framework;
     _hostContext = CreateApplicationHostContext();
 }
Exemplo n.º 5
0
 public DependencyListOperation(DependencyListOptions options, FrameworkName framework)
 {
     _options = options;
     _framework = framework;
     _libraryManager = CreateLibraryManager();
 }
Exemplo n.º 6
0
 public DependencyListOperation(DependencyListOptions options, FrameworkName framework)
 {
     _options        = options;
     _framework      = framework;
     _libraryManager = CreateLibraryManager();
 }
Exemplo n.º 7
0
 public MismatchedDependencyRenderer(DependencyListOptions options, FrameworkName framework)
 {
     _options   = options;
     _framework = framework;
 }
Exemplo n.º 8
0
 public DependencyListOperation(DependencyListOptions options, FrameworkName framework)
 {
     _options = options;
     _framework = framework;
     _hostContext = CreateApplicationHostContext();
 }
 public MismatchedDependencyRenderer(DependencyListOptions options, FrameworkName framework)
 {
     _options = options;
     _framework = framework;
 }