feat(remote): add new remote
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use clap::{App, Arg, SubCommand, ArgMatches};
|
||||
use std::borrow::Cow;
|
||||
use textwrap::{fill, Options};
|
||||
|
||||
use crate::commands::clone::{self, CloneArgs};
|
||||
|
||||
41
src/subcommands/remote.rs
Normal file
41
src/subcommands/remote.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use clap::{App, Arg, SubCommand, ArgMatches};
|
||||
|
||||
use crate::commands;
|
||||
use crate::commands::remote::RemoteArgs;
|
||||
|
||||
pub fn create() -> App<'static, 'static> {
|
||||
SubCommand::with_name("remote")
|
||||
.about("Manage set of tracked repositories")
|
||||
.subcommand(
|
||||
SubCommand::with_name("add")
|
||||
.arg(
|
||||
Arg::with_name("name")
|
||||
.required(true)
|
||||
.multiple(false)
|
||||
.takes_value(true)
|
||||
.value_name("NAME")
|
||||
.help("The name of the remote"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("url")
|
||||
.required(true)
|
||||
.multiple(false)
|
||||
.takes_value(true)
|
||||
.value_name("URL")
|
||||
.help("The url of the remote"),
|
||||
)
|
||||
.about("Add a new remote to this repository")
|
||||
)
|
||||
}
|
||||
|
||||
pub fn handler(args: &ArgMatches<'_>) {
|
||||
match args.subcommand() {
|
||||
("add", Some(add_matches)) => {
|
||||
commands::remote::remote_add(RemoteArgs {
|
||||
name: add_matches.values_of("name"),
|
||||
url: add_matches.values_of("url"),
|
||||
});
|
||||
}
|
||||
_ => println!("Invalid or missing subcommand for 'remote'"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user