UNPKG

@black-flag/core

Version:

A declarative framework for building fluent, deeply hierarchical command line interfaces with yargs

24 lines 1.43 kB
import type { ExecutionContext } from "./types/program.js"; /** * Recursively scans the filesystem for valid index files starting at * `basePath`, which can be a regular filesystem path or a `'file://...'`-style * URL. Upon encountering such a file, it is imported along with each valid * sibling file in the same directory, treating the raw results as * {@link ImportedConfigurationModule} objects. These are translated into * {@link Configuration} objects, which are then used to create and configure * corresponding {@link Program} instances. Finally, these generated * {@link Program} instances are wired together hierarchically as a well-ordered * tree of commands. This allows end users to invoke child commands through * their respective parent commands, starting with the root command. * * What are considered "valid" files are those files with one of the following * extensions (listed in precedence order): `.js`, `.mjs`, `.cjs`, `.ts`, * `.mts`, `.cts`. * * @returns An object with a `result` property containing the result of the * effector program that was executed. Due to the tree-like nature of execution, * `result` will not be available when the promise returned by * `discoverCommands` is resolved but it will be populated with a value when * `PreExecutionContext::execute` is called. */ export declare function discoverCommands(basePath_: unknown, context: ExecutionContext): Promise<void>;