History

First sketch of git-command API (#450)

Sebastian Thiel committed 4 years ago

Commit cd4a6081 parent 6c27e944 files · +58 −0Browse files

Showing the changes to git-command/src (1 of 4 files). Show all

Unified · Split

git-command/src/lib.rs+34−0
@@ -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
5use std::ffi::OsString;
6
7pub struct Prepare {
8 command: OsString,
9 use_shell: bool,
10}
11
12mod 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
31pub fn prepare(cmd: impl Into<OsString>) -> Prepare {
32 Prepare {
33 command: cmd.into(),
34 use_shell: false,
35 }
36}