build: Update 'git-browser' to 'git-view'

pull/6/head
sgoudham 3 years ago
parent f151f58b34
commit 5f0f2fff54
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -1,20 +1,20 @@
[package]
name = "git-browser"
name = "git-view"
version = "0.1.0"
edition = "2021"
authors = ["Goudham Suresh <sgoudham@gmail.com>"]
description = "A git sub-command to open your git repository in the web browser"
description = "A git sub-command to view your git repository in the web browser"
license = "MIT"
readme = "README.md"
repository = "https://github.com/sgoudham/git-browser"
repository = "https://github.com/sgoudham/git-view"
exclude = [".github/**"]
[[bin]]
name = "git-browser"
path = "src/bin/git-browser.rs"
name = "git-view"
path = "src/bin/git-view.rs"
[lib]
name = "git_browser"
name = "git_view"
path = "src/lib.rs"
[dependencies]

@ -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);
}
}

@ -1,13 +1,13 @@
use std::process::Command;
pub struct GitUpstream {
pub struct GitView {
remote: String,
branch: Option<String>,
is_commit: bool,
is_print: bool,
}
impl GitUpstream {
impl GitView {
pub fn new(branch: Option<String>, remote: String, is_commit: bool, is_print: bool) -> Self {
Self {
remote,
@ -23,6 +23,7 @@ impl GitUpstream {
// Retrieve the current branch
self.populate_branch()?;
let git_url = Command::new("git")
.args(["ls-remote", "--get-url", &self.remote])
.output()

Loading…
Cancel
Save