feat(remote): add new remote

This commit is contained in:
grimhilt
2024-02-20 15:45:01 +01:00
parent 7719e27fe8
commit c6534cfd40
7 changed files with 112 additions and 3 deletions

21
src/commands/remote.rs Normal file
View File

@@ -0,0 +1,21 @@
use clap::Values;
use crate::commands::config;
pub struct RemoteArgs<'a> {
pub name: Option<Values<'a>>,
pub url: Option<Values<'a>>,
}
pub fn remote_add(args: RemoteArgs) {
if args.name.is_none() || args.url.is_none() {
eprintln!("Missing argument: remote add command need a name and an url");
return;
}
let name = args.name.unwrap().next().unwrap();
let url = args.url.unwrap().next().unwrap();
let _ = config::add_remote(name, url);
}