Skip to content

Commit

Permalink
backend/borg: handle prompts
Browse files Browse the repository at this point in the history
Correctly parse question_prompt type messages
SebastianSpeitel committed Dec 14, 2022
1 parent b99d8d4 commit 1cfb63a
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backend/borg.rs
Original file line number Diff line number Diff line change
@@ -138,6 +138,10 @@ impl TryFrom<serde_json::Value> for Event {
}),
total: total().unwrap_or_default(),
},
"question_prompt" => Self::Prompt {
prompt: message().unwrap(),
msgid: msgid().unwrap(),
},
_ => return Err(format!("Unknown event type: {}", _type).into()),
};
Ok(event)
5 changes: 5 additions & 0 deletions src/borrg.rs
Original file line number Diff line number Diff line change
@@ -220,6 +220,10 @@ pub enum Event {
status: String,
path: PathBuf,
},
Prompt {
prompt: String,
msgid: String,
},
Other(String),
Error(Error),
}
@@ -261,6 +265,7 @@ impl Display for Event {
}
ProgressPercent { message, .. } => write!(f, "{message}"),
FileStatus { path, status } => write!(f, "{} {}", status, path.display()),
Prompt { prompt, .. } => write!(f, "{}", prompt),
Other(s) => write!(f, "{}", s),
Error(e) => write!(f, "{e}"),
}

0 comments on commit 1cfb63a

Please sign in to comment.