summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 1827e66..8958192 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,9 @@
mod core;
mod utilities;
+use std::path::PathBuf;
use clap::{Parser, Subcommand};
+use crate::core::GitRepository;
#[derive(Parser)]
#[command(version, about, long_about = None)]
@@ -12,13 +14,25 @@ struct Cli {
#[derive(Subcommand)]
enum Command {
- Init,
+ Init {
+ path: Option<PathBuf>,
+ },
}
fn main() {
let cli = Cli::parse();
match &cli.command {
- Command::Init => { todo!() }
+ Command::Init { path} => {
+ let mut p = PathBuf::new();
+ if let Some(path) = path.clone() {
+ p = path.clone();
+ } else {
+ if let Ok(path) = std::env::current_dir() {
+ p = path;
+ }
+ }
+ GitRepository::create_new_repo(p);
+ }
}
} \ No newline at end of file