1use crate::errors::CoreResult;
2
3use super::ViewerBackend;
4use super::util::{command_on_path, run_with_stdin};
5
6pub struct BatViewer;
8
9impl ViewerBackend for BatViewer {
10 fn name(&self) -> &str {
11 "bat"
12 }
13
14 fn description(&self) -> &str {
15 "Render the proposal in the terminal with bat"
16 }
17
18 fn is_available(&self) -> bool {
19 command_on_path("bat")
20 }
21
22 fn open(&self, content: &str) -> CoreResult<()> {
23 run_with_stdin("bat", &["--language=markdown", "--paging=always"], content)
24 }
25}