Prompter

Trait Prompter 

Source
pub trait Prompter {
    // Required method
    fn prompt(&self, ctx: &mut dyn Context, arg: &Arg) -> Result<String>;
}
Expand description

Prompts user for input interactively

Implement this trait to create custom prompt components:

use xacli_core::{Prompter, Arg, ArgValue, Context};
use std::io;

struct InputPrompter { message: String }
impl Prompter for InputPrompter {
    fn prompt(&self, ctx: &mut dyn Context, arg: &Arg) -> io::Result<ArgValue> {
        // Interactive prompt logic using ctx.read_event(), ctx.write_command(), etc.
        Ok(ArgValue::String("user input".into()))
    }
}

Required Methods§

Source

fn prompt(&self, ctx: &mut dyn Context, arg: &Arg) -> Result<String>

Implementors§