My project (https://github.com/migueldeicaza/gui.cs) has an example app called UI Catalog. The main UI Catalog app uses reflection to enumerate and display all of the examples; they all derive from the class Scenario
:
![image](https://user-images.githubusercontent.com/585482/165819459-cc91f3bc-0e8e-4c98-9b93-bb1494248eb8.png)
![image](https://user-images.githubusercontent.com/585482/165819560-c8bc1518-3819-4614-a3a7-6046bdc2343e.png)
The Scenarios are all in the ./Scenarios
dir; each as an individual .cs
file. The filename (e.g. Generic.cs
DOES NOT need to match the name of the Scenario (the real name is metadata on the Sceanario class).
UI Catalog
accepts the name of a Scenario on the command line; if provided it will directly launch that Scenario.
I'd like to enable dotnet example <Scenario>
.
I do not want to force each Scenario to have a .csproj
file or to be in a distinct dir.
I do not want to have to modify the existing Scenarios.
I do not want to have Scenario writers have to modify anything but their .cs
file (e.g. adding each Scenario to .examples
is no bueno).
I'm happy to contribute to this project to enhance it to support what I'm trying to do.
What would be your suggestion on the best way to do this?
My initial thought was to enhance .examples
such that this will work:
# Sample .examples file for UICatalog Scenarios
./UICatalog --list
dotnet example --list
would then build UICatalog/UICatalog.csproj
and run it with --list
. It would capture stdout to capture the resulting list of examples ("Name", "Description" pairs).
dotnet example <Scenario>
would build UICatalog/UICatalog.csproj
and run it with <Scenario>
.
What do you think?