Skip to content

samples: Add Argu.Samples.Introspect demonstrating the introspection API#298

Open
dimension-zero wants to merge 1 commit into
fsprojects:masterfrom
dimension-zero:pr/12-introspection-sample
Open

samples: Add Argu.Samples.Introspect demonstrating the introspection API#298
dimension-zero wants to merge 1 commit into
fsprojects:masterfrom
dimension-zero:pr/12-introspection-sample

Conversation

@dimension-zero
Copy link
Copy Markdown
Contributor

Summary

A new console sample under samples/Argu.Samples.Introspect/ that walks an ArgumentParser's schema:

  • GetArgumentCases() enumerates each case's ArgumentCaseInfo.
  • GetSubCommandParsers() returns the untyped child parsers.
  • IArgumentParserVisitor<'R> recovers the typed parser when only the untyped base is in scope.

The sample defines a minimal git-style schema (commit, push), prints every case at every nesting level, then prints the generated help text for comparison.

Why

There's no in-repo example showing how to walk a parser's schema. The pieces are documented individually but the assembly is left to the user.

Test plan

  • dotnet build -c Release — clean
  • dotnet run --project samples/Argu.Samples.Introspect — emits readable schema dump
  • dotnet test -c Release — 112/112 pass

A new console sample that walks an `ArgumentParser`'s schema:

- `GetArgumentCases()` enumerates each case's `ArgumentCaseInfo`
- `GetSubCommandParsers()` returns the untyped child parsers
- `IArgumentParserVisitor<'R>` recovers the typed parser when only the
  untyped base is in scope

The sample defines a minimal git-style schema (commit, push) and prints
the full case metadata at every nesting level, then prints the
generated help text for comparison.

Wired into Argu.sln under the `samples` folder alongside Argu.Samples.LS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant