CoreReplApp
Entry point for configuring and running a REPL application.
- Kind:
Class - Namespace: Repl
- Assembly:
Repl.Core - Source: src/Repl.Core/CoreReplApp.ShellCompletion.cs
Signature
Section titled “Signature”public sealed class CoreReplApp : ICoreReplApp, IReplMapInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Extension Methods
Section titled “Extension Methods”Context<CoreReplApp>(CoreReplApp, string, Action<CoreReplApp>, Delegate)UseDocumentationExport(CoreReplApp, Action<DocumentationExportOptions>)
Methods
Section titled “Methods”Context(string, Action<ICoreReplApp>, Delegate?)
Section titled “Context(string, Action<ICoreReplApp>, Delegate?)”Creates a top-level context segment and configures nested routes.
public IContextBuilder Context(string segment, Action<ICoreReplApp> configure, Delegate? validation = null)Parameters
Section titled “Parameters”segment(string): Context segment.configure(Action<ICoreReplApp>): Nested configuration callback.validation(Delegate): Optional scope validation delegate.
Returns
Section titled “Returns”IContextBuilder - A context builder for context-level metadata configuration.
Context(string, Action<IReplMap>, Delegate?)
Section titled “Context(string, Action<IReplMap>, Delegate?)”Creates a top-level context segment and configures nested routes. Compatibility overload for IReplMap callbacks.
public IContextBuilder Context(string segment, Action<IReplMap> configure, Delegate? validation = null)Parameters
Section titled “Parameters”Returns
Section titled “Returns”Create()
Section titled “Create()”Creates a dependency-free REPL application instance.
public static CoreReplApp Create()Returns
Section titled “Returns”CoreReplApp - A new CoreReplApp instance.
CreateDocumentationModel(string?)
Section titled “CreateDocumentationModel(string?)”Builds a structured documentation model of the command graph.
public ReplDocumentationModel CreateDocumentationModel(string? targetPath = null)Parameters
Section titled “Parameters”targetPath(string): Optional target path to scope the model. Whennull, returns the full model. When specified and not found, returns an empty model.
Returns
Section titled “Returns”ReplDocumentationModel - A structured documentation model.
InvalidateRouting()
Section titled “InvalidateRouting()”Invalidates active routing cache so module presence predicates are re-evaluated on next resolution.
public void InvalidateRouting()Map(string, Delegate)
Section titled “Map(string, Delegate)”Maps a route and command handler.
public CommandBuilder Map(string route, Delegate handler)Parameters
Section titled “Parameters”Returns
Section titled “Returns”CommandBuilder - A command builder for metadata configuration.
MapModule(IReplModule)
Section titled “MapModule(IReplModule)”Maps a module instance.
public CoreReplApp MapModule(IReplModule module)Parameters
Section titled “Parameters”module(IReplModule): Module instance.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
MapModule(IReplModule, Func<ModulePresenceContext, bool>)
Section titled “MapModule(IReplModule, Func<ModulePresenceContext, bool>)”Maps a module instance with a runtime presence predicate.
public CoreReplApp MapModule(IReplModule module, Func<ModulePresenceContext, bool> isPresent)Parameters
Section titled “Parameters”module(IReplModule): Module instance.isPresent(Func<ModulePresenceContext, bool>): Runtime presence predicate.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
MapModule<TModule>()
Section titled “MapModule<TModule>()”Maps a module resolved through runtime activation.
public CoreReplApp MapModule<TModule>() where TModule : class, IReplModuleType Parameters
Section titled “Type Parameters”TModule: Module type.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
MapModule<TModule>(Func<ModulePresenceContext, bool>)
Section titled “MapModule<TModule>(Func<ModulePresenceContext, bool>)”Maps a module resolved through runtime activation with a runtime presence predicate.
public CoreReplApp MapModule<TModule>(Func<ModulePresenceContext, bool> isPresent) where TModule : class, IReplModuleType Parameters
Section titled “Type Parameters”TModule: Module type.
Parameters
Section titled “Parameters”isPresent(Func<ModulePresenceContext, bool>): Runtime presence predicate.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
Options(Action<ReplOptions>)
Section titled “Options(Action<ReplOptions>)”Configures application options.
public CoreReplApp Options(Action<ReplOptions> configure)Parameters
Section titled “Parameters”configure(Action<ReplOptions>): Options callback.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
Run(string[])
Section titled “Run(string[])”Runs the app in synchronous mode.
public int Run(string[] args)Parameters
Section titled “Parameters”args(string[]): Command-line arguments.
Returns
Section titled “Returns”int - Process exit code.
RunAsync(string[], CancellationToken)
Section titled “RunAsync(string[], CancellationToken)”Runs the app in asynchronous mode.
public ValueTask<int> RunAsync(string[] args, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”args(string[]): Command-line arguments.cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<int> - Process exit code.
Use(Func<ReplExecutionContext, ReplNext, ValueTask>)
Section titled “Use(Func<ReplExecutionContext, ReplNext, ValueTask>)”Registers middleware in the execution pipeline.
public CoreReplApp Use(Func<ReplExecutionContext, ReplNext, ValueTask> middleware)Parameters
Section titled “Parameters”middleware(Func<ReplExecutionContext, ReplNext, ValueTask>): Middleware delegate.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
WithBanner(Delegate)
Section titled “WithBanner(Delegate)”Registers a banner delegate displayed at startup after the header line. Unlike WithDescription(string), which is structural metadata visible in help and documentation, banners are display-only messages that appear at runtime.
public CoreReplApp WithBanner(Delegate bannerProvider)Parameters
Section titled “Parameters”bannerProvider(Delegate): Banner delegate with injectable parameters.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
WithBanner(string)
Section titled “WithBanner(string)”Registers a static banner string displayed at startup after the header line. Unlike WithDescription(string), which is structural metadata visible in help and documentation, banners are display-only messages that appear at runtime.
public CoreReplApp WithBanner(string text)Parameters
Section titled “Parameters”text(string): Banner text.
Returns
Section titled “Returns”CoreReplApp - The same app instance.
WithDescription(string)
Section titled “WithDescription(string)”Sets an application description for discovery and banner usage.
public CoreReplApp WithDescription(string text)Parameters
Section titled “Parameters”text(string): Description text.
Returns
Section titled “Returns”CoreReplApp - The same app instance.