git_revise/revise/prompts/
commit_ai.rs

1use inquire::Select;
2
3use super::Inquire;
4use crate::error::ReviseResult;
5
6#[derive(Debug, Clone)]
7pub struct Part {
8    pub msg: String,
9    pub ans: Option<String>,
10    pub options: Vec<String>,
11}
12
13impl Part {
14    pub fn new(options: Vec<String>) -> Self {
15        Self {
16            msg: "Select the message to be committing :".to_string(),
17            ans: None,
18            options,
19        }
20    }
21}
22
23impl Inquire for Part {
24    fn inquire(&mut self) -> ReviseResult<()> {
25        let ans = Select::new(&self.msg, self.options.clone()).prompt()?;
26        self.ans = Some(ans);
27        Ok(())
28    }
29}