built out some more the arguments for gt
more to come
This commit is contained in:
parent
449717282e
commit
9c6381dcfe
71
src/arg.rs
Normal file
71
src/arg.rs
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
use clap::{App, Arg, SubCommand, ArgMatches};
|
||||||
|
|
||||||
|
/// Global function that grabs the arguments and shows the user help on any given command.
|
||||||
|
/// An error occurs when a command passes through and it doesn't match the argument specified.
|
||||||
|
pub fn get_args() -> ArgMatches<'static> {
|
||||||
|
let matches = App::new("gt")
|
||||||
|
.version("0.0.1")
|
||||||
|
.author("Wyatt J. Miller <wjmiller2016@gmail.com>")
|
||||||
|
.about("It's a Gitea CLI client!")
|
||||||
|
.subcommand(SubCommand::with_name("repo")
|
||||||
|
.about("Create, delete, list, search, or fork a repository")
|
||||||
|
.arg(Arg::with_name("create")
|
||||||
|
.short("c")
|
||||||
|
.long("create")
|
||||||
|
.value_names(&["REPO"])
|
||||||
|
.help("Create a repository for a user")
|
||||||
|
)
|
||||||
|
.arg(Arg::with_name("search")
|
||||||
|
.short("s")
|
||||||
|
.long("search")
|
||||||
|
.value_name("REPO")
|
||||||
|
.help("Search repositories for a user")
|
||||||
|
)
|
||||||
|
.arg(Arg::with_name("list")
|
||||||
|
.short("l")
|
||||||
|
.long("list")
|
||||||
|
.help("List all the repositories for the authenticated user")
|
||||||
|
)
|
||||||
|
.arg(Arg::with_name("delete")
|
||||||
|
.short("d")
|
||||||
|
.long("delete")
|
||||||
|
.value_names(&["OWNER", "REPO"])
|
||||||
|
.help("Delete a repository for a user")
|
||||||
|
)
|
||||||
|
.arg(Arg::with_name("fork")
|
||||||
|
.short("f")
|
||||||
|
.long("fork")
|
||||||
|
.value_names(&["OWNER", "REPO"])
|
||||||
|
.help("Fork a repository for a user")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.subcommand(SubCommand::with_name("issue")
|
||||||
|
.about("Create, search, comment, close, or reopen an issue")
|
||||||
|
.arg(Arg::with_name("create")
|
||||||
|
.short("c")
|
||||||
|
.long("c")
|
||||||
|
.value_names(&["OWNER"])
|
||||||
|
.help("Create an issue for a repository")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.subcommand(SubCommand::with_name("pr")
|
||||||
|
.about("Create, search, comment, merge, and close pull requests")
|
||||||
|
.arg(Arg::with_name("create")
|
||||||
|
.short("c")
|
||||||
|
.long("create")
|
||||||
|
.value_names(&["REPO"])
|
||||||
|
.help("Create a new pull request for a repository")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.subcommand(SubCommand::with_name("user")
|
||||||
|
.about("Check the status, repositories, followers, and other such items about your and others user")
|
||||||
|
.arg(Arg::with_name("get")
|
||||||
|
.short("g")
|
||||||
|
.long("get")
|
||||||
|
.help("Get your authenticated user")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.get_matches();
|
||||||
|
|
||||||
|
matches
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user