summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-03-11 22:33:28 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-03-11 22:33:28 +0200
commit85d187133ddcea5284529bc57caaa7f66f73ab95 (patch)
tree62852b8bda4b2982ec240eb762eaa2c4892859c3 /src
parent5b52ed7ed242ce40cfd331a2fdb78e106413e138 (diff)
Fix docker shell issue
Diffstat (limited to 'src')
-rw-r--r--src/main.rs14
-rw-r--r--src/parser.rs10
2 files changed, 23 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 142b4fc..ebbf23a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,4 @@
-use std::{io, io::Write};
+use std::{io, io::Write, process};
use thiserror::Error;
mod git;
@@ -35,6 +35,18 @@ fn main() -> Result<(), ShackleError> {
git::init(&repo_name)?; // TODO should report this error differently
println!("Successfully created {}.git", repo_name);
}
+ Ok(Command::GitUploadPack(git_dir)) => {
+ process::Command::new("git")
+ .args(["upload-pack", &git_dir])
+ .spawn()?
+ .wait()?;
+ }
+ Ok(Command::GitReceivePack(git_dir)) => {
+ process::Command::new("git")
+ .args(["receive-pack", &git_dir])
+ .spawn()?
+ .wait()?;
+ }
}
}
Ok(())
diff --git a/src/parser.rs b/src/parser.rs
index 2f65180..64ebf5b 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -15,6 +15,8 @@ pub enum Command {
Whitespace,
Exit,
GitInit(String),
+ GitUploadPack(String),
+ GitReceivePack(String),
}
impl FromStr for Command {
@@ -44,6 +46,14 @@ fn command_parser(input: &str) -> IResult<&str, Command> {
ws(tuple((tag("git-init"), multispace1, not_space))),
|(_, _, repo_name)| Command::GitInit(repo_name.to_owned()),
),
+ map(
+ ws(tuple((tag("git upload-pack"), multispace1, not_space))),
+ |(_, _, git_dir)| Command::GitUploadPack(git_dir.to_owned()),
+ ),
+ map(
+ ws(tuple((tag("git receive-pack"), multispace1, not_space))),
+ |(_, _, git_dir)| Command::GitReceivePack(git_dir.to_owned()),
+ ),
))(input)
}