CliAdapter

Trait CliAdapter 

Source
pub trait CliAdapter {
    // Required methods
    fn name(&self) -> &'static str;
    fn dependencies(&self) -> Vec<Dependency>;
    fn generate_cli(&self, info: &CliInfo) -> Vec<CodeFragment>;
    fn generate_command(&self, info: &CommandMeta) -> Vec<CodeFragment>;
    fn generate_subcommands(&self, info: &CommandMeta) -> Vec<CodeFragment>;
    fn generate_dispatch(&self, info: &DispatchInfo) -> Vec<CodeFragment>;
    fn imports(&self) -> Vec<ImportSpec>;
    fn command_imports(&self, info: &CommandMeta) -> Vec<ImportSpec>;
    fn map_arg_type(&self, arg_type: ArgType) -> &'static str;
    fn map_optional_type(&self, arg_type: ArgType) -> String;
}
Expand description

Trait for CLI framework adapters.

Implement this trait to support a specific CLI framework (clap, boune, etc.).

Required Methods§

Source

fn name(&self) -> &'static str

Adapter name for identification.

Source

fn dependencies(&self) -> Vec<Dependency>

Dependencies required by this adapter.

Source

fn generate_cli(&self, info: &CliInfo) -> Vec<CodeFragment>

Generate the main CLI entry point structure/definition.

Source

fn generate_command(&self, info: &CommandMeta) -> Vec<CodeFragment>

Generate a command definition (args struct, command object, etc.).

Source

fn generate_subcommands(&self, info: &CommandMeta) -> Vec<CodeFragment>

Generate subcommand enum/routing for a parent command.

Source

fn generate_dispatch(&self, info: &DispatchInfo) -> Vec<CodeFragment>

Generate dispatch logic for routing to handlers.

Source

fn imports(&self) -> Vec<ImportSpec>

Imports needed for CLI code.

Source

fn command_imports(&self, info: &CommandMeta) -> Vec<ImportSpec>

Imports needed for a specific command.

Source

fn map_arg_type(&self, arg_type: ArgType) -> &'static str

Map an argument type to the adapter’s type string.

Source

fn map_optional_type(&self, arg_type: ArgType) -> String

Map an optional argument type to the adapter’s type string.

Implementors§