Browse Source

Fixes some bugs

master
Thomas Forgione 4 months ago
parent
commit
a2767ee117
Signed by: Thomas Forgione <thomas@forgione.fr> GPG Key ID: 203DAEA747F48F41
2 changed files with 18 additions and 1 deletions
  1. 9
    0
      assets/help.txt
  2. 9
    1
      src/gclone.rs

+ 9
- 0
assets/help.txt View File

@@ -0,0 +1,9 @@
gclone 0.1.0
Thomas Forgione <thomas@forgione.fr>
Easily clone a git repository in the right place

USAGE:
gclone <URL>

ARGS:
URL The url of the repository (can be HTTP, HTTPS or SSH)

+ 9
- 1
src/gclone.rs View File

@@ -6,7 +6,9 @@ use colored::*;
use gclone::git::{clone, parse_url, GCLONE_PATH};
use gclone::{first_arg, Cache, Result};

fn help() {}
fn help() {
print!(include_str!("../assets/help.txt"));
}

fn main_result() -> Result<()> {
// Parse args
@@ -16,6 +18,12 @@ fn main_result() -> Result<()> {
return Ok(help());
}

let url = if url.ends_with(".git") {
&url[0..url.len() - 4]
} else {
&url
};

let (server, owner, repo) = parse_url(&url)?;

// Build path

Loading…
Cancel
Save