diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-04-07 11:50:57 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-04-07 11:50:57 +0200 |
commit | 108fef99d19ade71013dc25562e3c3c3e23347ef (patch) | |
tree | fd2082991d11fdbfe00c4345c0daec49e070c999 /src | |
parent | d7ac6f915079c2385be902106f97b994f5f65bc5 (diff) |
Failing test for setting description
Diffstat (limited to 'src')
-rw-r--r-- | src/git.rs | 6 | ||||
-rw-r--r-- | src/lib.rs | 8 | ||||
-rw-r--r-- | src/parser.rs | 2 |
3 files changed, 13 insertions, 3 deletions
@@ -65,7 +65,11 @@ fn is_valid_git_repo_path(path: &PathBuf) -> Result<bool, ShackleError> { } } -pub fn init(repo_name: &str, group: &Option<String>) -> Result<GitInitResult, ShackleError> { +pub fn init( + repo_name: &str, + group: &Option<String>, + description: &Option<String>, +) -> Result<GitInitResult, ShackleError> { fn init_group(repo_name: &str, group: &str) -> Result<GitInitResult, ShackleError> { if !verify_user_is_in_group(group) { return Err(ShackleError::InvalidGroup); @@ -26,8 +26,12 @@ pub fn run_command(user_input: String) -> Result<ControlFlow<(), ()>, ShackleErr println!("{table}"); } - Ok(ShackleCommand::GitInit(GitInitArgs { repo_name, group })) => { - let init_result = git::init(&repo_name, &group)?; + Ok(ShackleCommand::GitInit(GitInitArgs { + repo_name, + group, + description, + })) => { + let init_result = git::init(&repo_name, &group, &description)?; println!("Successfully created \"{}\"", init_result.path.display()); } Ok(ShackleCommand::GitUploadPack(upload_pack_args)) => { diff --git a/src/parser.rs b/src/parser.rs index 88b32bb..5295483 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -22,6 +22,8 @@ pub enum ShackleCommand { pub struct GitInitArgs { #[arg(long)] pub group: Option<String>, + #[arg(long)] + pub description: Option<String>, pub repo_name: String, } |