Browse Source

Fixes some bugs

master
Thomas Forgione 2 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 @@
1
+gclone 0.1.0
2
+Thomas Forgione <thomas@forgione.fr>
3
+Easily clone a git repository in the right place
4
+
5
+USAGE:
6
+    gclone <URL>
7
+
8
+ARGS:
9
+    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::*;
6 6
 use gclone::git::{clone, parse_url, GCLONE_PATH};
7 7
 use gclone::{first_arg, Cache, Result};
8 8
 
9
-fn help() {}
9
+fn help() {
10
+    print!(include_str!("../assets/help.txt"));
11
+}
10 12
 
11 13
 fn main_result() -> Result<()> {
12 14
     // Parse args
@@ -16,6 +18,12 @@ fn main_result() -> Result<()> {
16 18
         return Ok(help());
17 19
     }
18 20
 
21
+    let url = if url.ends_with(".git") {
22
+         &url[0..url.len() - 4]
23
+    } else {
24
+        &url
25
+    };
26
+
19 27
     let (server, owner, repo) = parse_url(&url)?;
20 28
 
21 29
     // Build path

Loading…
Cancel
Save