feat(remote): list remote with verbose option

This commit is contained in:
grimhilt
2024-03-01 15:35:38 +01:00
parent 8ed86a05ea
commit d8b2116aeb
4 changed files with 82 additions and 17 deletions

View File

@@ -2,6 +2,8 @@ use clap::Values;
use crate::commands::config;
use super::config::get_all_remote;
pub struct RemoteArgs<'a> {
pub name: Option<Values<'a>>,
pub url: Option<Values<'a>>,
@@ -19,3 +21,17 @@ pub fn remote_add(args: RemoteArgs) {
let _ = config::add_remote(name, url);
}
pub fn remote_list(verbose: bool) {
let remotes = get_all_remote();
for remote in remotes {
if verbose
{
println!("{} {}", remote.0, remote.1);
}
else
{
println!("{}", remote.0);
}
}
}