Ejemplo n.º 1
0
        private static async Task <int> GenerateSourceReferencesAsync(GenerateSourceReferencesCommandLineOptions options)
        {
            if (!TryParseOptionValueAsEnum(options.Depth, ParameterNames.Depth, out DocumentationDepth depth, DocumentationOptions.Default.Depth))
            {
                return(1);
            }

            if (!TryParseOptionValueAsEnum(options.Visibility, ParameterNames.Visibility, out Visibility visibility))
            {
                return(1);
            }

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

            var command = new GenerateSourceReferencesCommand(
                options,
                depth,
                visibility,
                projectFilter);

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

            return((result.Kind == CommandResultKind.Success) ? 0 : 1);
        }
Ejemplo n.º 2
0
        private static async Task <int> GenerateSourceReferencesAsync(GenerateSourceReferencesCommandLineOptions options)
        {
            if (!TryParseOptionValueAsEnum(options.Depth, OptionNames.Depth, out DocumentationDepth depth, DocumentationOptions.Default.Depth))
            {
                return(ExitCodes.Error);
            }

            if (!TryParseOptionValueAsEnum(options.Visibility, OptionNames.Visibility, out Visibility visibility))
            {
                return(ExitCodes.Error);
            }

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

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

            var command = new GenerateSourceReferencesCommand(
                options,
                depth,
                visibility,
                projectFilter);

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

            return(GetExitCode(status));
        }