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 @@
11 #![deny(rust_2018_idioms)]
22 #![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+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t