Beispiel #1
0
        private static async Task <int> ListReferencesAsync(ListReferencesCommandLineOptions options)
        {
            if (!TryParseOptionValueAsEnum(options.Display, ParameterNames.Display, out MetadataReferenceDisplay display, MetadataReferenceDisplay.Path))
            {
                return(1);
            }

            if (!TryParseOptionValueAsEnumFlags(options.Type, ParameterNames.Type, out MetadataReferenceFilter metadataReferenceFilter, MetadataReferenceFilter.Dll | MetadataReferenceFilter.Project))
            {
                return(1);
            }

            if (!options.TryGetProjectFilter(out ProjectFilter projectFilter))
            {
                return(1);
            }

            var command = new ListReferencesCommand(
                options,
                display,
                metadataReferenceFilter,
                projectFilter);

            CommandResult result = await command.ExecuteAsync(options.Path, options.MSBuildPath, options.Properties);

            return((result == CommandResult.Success) ? 0 : 1);
        }
Beispiel #2
0
        private static async Task <int> ListReferencesAsync(ListReferencesCommandLineOptions options)
        {
            if (!TryParseOptionValueAsEnum(options.Display, OptionNames.Display, out MetadataReferenceDisplay display, MetadataReferenceDisplay.Path))
            {
                return(ExitCodes.Error);
            }

            if (!TryParseOptionValueAsEnumFlags(options.Type, OptionNames.Type, out MetadataReferenceFilter metadataReferenceFilter, MetadataReferenceFilter.Dll | MetadataReferenceFilter.Project))
            {
                return(ExitCodes.Error);
            }

            if (!options.TryGetProjectFilter(out ProjectFilter projectFilter))
            {
                return(ExitCodes.Error);
            }

            if (!TryParsePaths(options.Paths, out ImmutableArray <string> paths))
            {
                return(ExitCodes.Error);
            }

            var command = new ListReferencesCommand(
                options,
                display,
                metadataReferenceFilter,
                projectFilter);

            CommandStatus status = await command.ExecuteAsync(paths, options.MSBuildPath, options.Properties);

            return(GetExitCode(status));
        }