Skip to main content

Prompter

Trait Prompter 

Source
pub trait Prompter {
    // Required methods
    fn select_mode(&self) -> Result<CliMode, PawError>;
    fn select_branches(
        &self,
        branches: &[String],
    ) -> Result<Vec<String>, PawError>;
    fn select_cli(
        &self,
        clis: &[CliInfo],
        default: Option<&str>,
    ) -> Result<String, PawError>;
    fn select_cli_for_branch(
        &self,
        branch: &str,
        clis: &[CliInfo],
    ) -> Result<String, PawError>;
}
Expand description

Abstraction over interactive prompts, allowing test doubles.

Required Methods§

Source

fn select_mode(&self) -> Result<CliMode, PawError>

Ask the user to choose between uniform and per-branch CLI assignment.

Source

fn select_branches(&self, branches: &[String]) -> Result<Vec<String>, PawError>

Ask the user to pick one or more branches. Returns selected branch names.

Source

fn select_cli( &self, clis: &[CliInfo], default: Option<&str>, ) -> Result<String, PawError>

Ask the user to pick a single CLI for all branches. Returns binary name.

When default is Some and matches a CLI’s binary_name, that entry is pre-selected in the picker. Otherwise the first item is selected.

Source

fn select_cli_for_branch( &self, branch: &str, clis: &[CliInfo], ) -> Result<String, PawError>

Ask the user to pick a CLI for a specific branch. Returns binary name.

Implementors§