attempt to use ssh

This commit is contained in:
breadone 2024-03-10 16:30:22 +13:00
parent 45027ad826
commit dc1bdfd9aa
No known key found for this signature in database
2 changed files with 36 additions and 27 deletions

33
src/git.rs Normal file
View File

@ -0,0 +1,33 @@
use clap::Subcommand;
use std::process::Command;
#[derive(Subcommand)]
pub enum GitCommand {
Create {
#[arg()]
name: String
},
List,
Delete {
#[arg()]
name: String
}
}
pub fn handle_git(cmd: &GitCommand) {
match cmd {
GitCommand::Create { name } => {
let path = format!("git@breadpi:~/store/{}", name);
let git_create = Command::new("ssh")
.args([path])
.spawn()
.expect("Could not create remote repo!");
}
_ => {
println!("oopsies")
}
}
}

View File

@ -1,4 +1,7 @@
mod git;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use crate::git::{handle_git, GitCommand};
#[derive(Subcommand)] #[derive(Subcommand)]
enum Command { enum Command {
@ -8,20 +11,6 @@ enum Command {
} }
} }
#[derive(Subcommand)]
enum GitCommand {
Create {
#[arg()]
name: String
},
List,
Delete {
#[arg()]
name: String
}
}
#[derive(Parser)] #[derive(Parser)]
struct Cli { struct Cli {
@ -38,16 +27,3 @@ fn main() {
} }
} }
} }
fn handle_git(cmd: &GitCommand) {
match cmd {
GitCommand::Create { name } => {
println!("{}", name);
}
_ => {
println!("oopsies")
}
}
}