Skip to content

Allow custom exporter options to be defined #1967

Open
@PaulRitter

Description

@PaulRitter

Currently options for the exporters console argument are hardcoded here:

private static readonly IReadOnlyDictionary<string, IExporter[]> AvailableExporters =
new Dictionary<string, IExporter[]>(StringComparer.InvariantCultureIgnoreCase)
{
{ "csv", new[] { CsvExporter.Default } },
{ "csvmeasurements", new[] { CsvMeasurementsExporter.Default } },
{ "html", new[] { HtmlExporter.Default } },
{ "markdown", new[] { MarkdownExporter.Default } },
{ "atlassian", new[] { MarkdownExporter.Atlassian } },
{ "stackoverflow", new[] { MarkdownExporter.StackOverflow } },
{ "github", new[] { MarkdownExporter.GitHub } },
{ "plain", new[] { PlainExporter.Default } },
{ "rplot", new[] { CsvMeasurementsExporter.Default, RPlotExporter.Default } }, // R Plots depends on having the full measurements available
{ "json", new[] { JsonExporter.Default } },
{ "briefjson", new[] { JsonExporter.Brief } },
{ "fulljson", new[] { JsonExporter.Full } },
{ "asciidoc", new[] { AsciiDocExporter.Default } },
{ "xml", new[] { XmlExporter.Default } },
{ "briefxml", new[] { XmlExporter.Brief } },
{ "fullxml", new[] { XmlExporter.Full } }
};

I would love a way to add custom exporters as options to this list.

Activity

PaulRitter

PaulRitter commented on Mar 26, 2022

@PaulRitter
Author
changed the title [-]Allow custom exporters to be defined[/-] [+]Allow custom exporter options to be defined[/+] on Mar 26, 2022
PaulRitter

PaulRitter commented on Mar 26, 2022

@PaulRitter
Author

actually, i will reopen this since it would be nice to be able to define exporter-options which are selectable over the args.

adamsitnik

adamsitnik commented on Oct 5, 2022

@adamsitnik
Member

i will reopen this since it would be nice to be able to define exporter-options which are selectable over the args.

@PaulRitter Could you please elaborate more on that? Please provide sample API design and code example.

PaulRitter

PaulRitter commented on Oct 15, 2022

@PaulRitter
Author

i will reopen this since it would be nice to be able to define exporter-options which are selectable over the args.

@PaulRitter Could you please elaborate more on that? Please provide sample API design and code example.

I updated the original comment, did that clear it up? Otherwise im open to thinking a bit more on the idea and coming up with an entire API proposal, but i'd have to get more familiar with the project for that.

adamsitnik

adamsitnik commented on Oct 20, 2022

@adamsitnik
Member

@PaulRitter now I get it: you would like to have the possibility to extend the existing command line argument parsing logic with the possibility to specify user-defined exporters so you can do sth like --exporter myExporter.

We could introduce a new method:

public static class ConfigParser
{
   public static void RegisterCustomExporter(string commandLineName, IExporter exporter) => AvailableExporters.Add(commandLineName, exporter);
}

@PaulRitter if that is what you need please send a PR.

modified the milestones: v0.13.3, v0.13.x on Oct 20, 2022

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @adamsitnik@nazulg@PaulRitter@timcassell

      Issue actions

        Allow custom exporter options to be defined · Issue #1967 · dotnet/BenchmarkDotNet