diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/main.rs b/src/main.rs index 4b62aa1..4333866 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,6 @@ -mod git; -mod parser; - use clap::Parser; -use parser::*; use rustyline::{error::ReadlineError, DefaultEditor}; -use std::{io, ops::ControlFlow}; -use thiserror::Error; +use shackle::{run_command, ShackleError}; /// Shackle Shell - A replacement for git-shell with repo management commands built in. #[derive(Parser, Debug)] @@ -30,29 +25,6 @@ fn main() -> Result<(), ShackleError> { Ok(()) } -fn run_command(user_input: String) -> Result<ControlFlow<(), ()>, ShackleError> { - match user_input.parse::<ShackleCommand>() { - Err(parse_error) => { - println!("{}", parse_error); - } - Ok(ShackleCommand::Whitespace) => {} - Ok(ShackleCommand::Exit) => { - return Ok(ControlFlow::Break(())); - } - Ok(ShackleCommand::GitInit(GitInitArgs { repo_name })) => { - git::init(&repo_name)?; - println!("Successfully created \"{}.git\"", repo_name); - } - Ok(ShackleCommand::GitUploadPack(upload_pack_args)) => { - git::upload_pack(&upload_pack_args)?; - } - Ok(ShackleCommand::GitReceivePack(receive_pack_args)) => { - git::receive_pack(&receive_pack_args)?; - } - } - Ok(ControlFlow::Continue(())) -} - fn run_interactive_loop() -> Result<(), ShackleError> { let mut rl = DefaultEditor::new()?; loop { @@ -86,15 +58,3 @@ fn run_interactive_loop() -> Result<(), ShackleError> { } Ok(()) } - -pub enum FlowControl {} - -#[derive(Error, Debug)] -pub enum ShackleError { - #[error(transparent)] - IoError(#[from] io::Error), - #[error(transparent)] - GitError(#[from] git2::Error), - #[error(transparent)] - ReadlineError(#[from] ReadlineError), -} |