|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
use std::panic::set_hook;
|
|
|
|
|
|
|
|
|
|
use clap::{command, crate_authors, crate_description, crate_version, Arg, Command, ErrorKind};
|
|
|
|
|
use git_browser::GitUpstream;
|
|
|
|
|
use git_view::GitView;
|
|
|
|
|
|
|
|
|
|
macro_rules! clap_panic {
|
|
|
|
|
($e:expr) => {
|
|
|
|
@ -12,15 +12,15 @@ macro_rules! clap_panic {
|
|
|
|
|
fn main() {
|
|
|
|
|
set_hook(Box::new(|info| clap_panic!(info)));
|
|
|
|
|
|
|
|
|
|
let matches = Command::new("git-upstream")
|
|
|
|
|
let matches = Command::new("git-view")
|
|
|
|
|
.version(crate_version!())
|
|
|
|
|
.author(crate_authors!())
|
|
|
|
|
.about(crate_description!())
|
|
|
|
|
.long_about(None)
|
|
|
|
|
.arg(Arg::new("branch").help("The branch to open Github repo on"))
|
|
|
|
|
.arg(Arg::new("branch").help("The branch to view git repository on"))
|
|
|
|
|
.arg(
|
|
|
|
|
Arg::new("remote")
|
|
|
|
|
.help("The remote to open Github repo on")
|
|
|
|
|
.help("The remote to view git repository on")
|
|
|
|
|
.short('r')
|
|
|
|
|
.long("remote")
|
|
|
|
|
.default_value("origin"),
|
|
|
|
@ -40,14 +40,14 @@ fn main() {
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let matches = matches.get_matches();
|
|
|
|
|
let mut git_upstream = GitUpstream::new(
|
|
|
|
|
let mut git_view = GitView::new(
|
|
|
|
|
matches.value_of("branch").map(str::to_string),
|
|
|
|
|
matches.value_of("remote").unwrap().to_string(),
|
|
|
|
|
matches.is_present("commit"),
|
|
|
|
|
matches.is_present("print"),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if let Err(err) = git_upstream.open_upstream_repository() {
|
|
|
|
|
if let Err(err) = git_view.open_upstream_repository() {
|
|
|
|
|
clap_panic!(err);
|
|
|
|
|
}
|
|
|
|
|
}
|