(&self, value: &serde_json::Value)
| 46 | } |
| 47 | |
| 48 | pub fn prepare(&self, value: &serde_json::Value) -> Result<Exec, Error> { |
| 49 | let mut cmd = Exec::cmd(&self.command); |
| 50 | for arg in &self.args { |
| 51 | cmd = cmd.arg(self.templates.render(arg, value)?); |
| 52 | } |
| 53 | |
| 54 | if self.stdin { |
| 55 | cmd = cmd.stdin(self.templates.render("stdin", value)?.as_str()); |
| 56 | } |
| 57 | |
| 58 | Ok(cmd) |
| 59 | } |
| 60 | |
| 61 | pub fn prompt(&self, cmd: &Exec, value: &serde_json::Value) -> Result<String, Error> { |
| 62 | let cmd_str = cmd.to_cmdline_lossy(); |