Showing the changes to git-command/src (1 of 4 files). Show all
Unified · Split
| @@ -1,2 +1,36 @@ | |||
| 1 | #![deny(rust_2018_idioms)] | 1 | #![deny(rust_2018_idioms)] |
| 2 | #![forbid(unsafe_code)] | 2 | #![forbid(unsafe_code)] |
| 3 | #![allow(dead_code)] | ||
| 4 | |||
| 5 | use std::ffi::OsString; | ||
| 6 | |||
| 7 | pub struct Prepare { | ||
| 8 | command: OsString, | ||
| 9 | use_shell: bool, | ||
| 10 | } | ||
| 11 | |||
| 12 | mod prepare { | ||
| 13 | use crate::Prepare; | ||
| 14 | |||
| 15 | /// Builder | ||
| 16 | impl Prepare { | ||
| 17 | pub fn with_shell(mut self) -> Self { | ||
| 18 | self.use_shell = true; | ||
| 19 | self | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | /// Finalization | ||
| 24 | impl Prepare { | ||
| 25 | pub fn spawn(self) -> std::io::Result<std::process::Child> { | ||
| 26 | todo!("create command and spawn that") | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | pub fn prepare(cmd: impl Into<OsString>) -> Prepare { | ||
| 32 | Prepare { | ||
| 33 | command: cmd.into(), | ||
| 34 | use_shell: false, | ||
| 35 | } | ||
| 36 | } | ||