attempt to use ssh
This commit is contained in:
parent
45027ad826
commit
dc1bdfd9aa
33
src/git.rs
Normal file
33
src/git.rs
Normal 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")
|
||||
}
|
||||
}
|
||||
}
|
30
src/main.rs
30
src/main.rs
@ -1,4 +1,7 @@
|
||||
mod git;
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use crate::git::{handle_git, GitCommand};
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Command {
|
||||
@ -8,20 +11,6 @@ enum Command {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum GitCommand {
|
||||
Create {
|
||||
#[arg()]
|
||||
name: String
|
||||
},
|
||||
|
||||
List,
|
||||
|
||||
Delete {
|
||||
#[arg()]
|
||||
name: String
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
@ -38,16 +27,3 @@ fn main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn handle_git(cmd: &GitCommand) {
|
||||
match cmd {
|
||||
GitCommand::Create { name } => {
|
||||
println!("{}", name);
|
||||
}
|
||||
|
||||
_ => {
|
||||
println!("oopsies")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user