Skip to content

Commit

Permalink
Print message after cloning
Browse files Browse the repository at this point in the history
So it's the last thing output.
  • Loading branch information
wezm committed Jul 4, 2022
1 parent 5a9ba84 commit 00ad1cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Git Grab clones a repo into `$GRAB_HOME`, organised by domain and path.
argument. For example:

$ git grab github.com/wezm/git-grab
Grab https://github.com/wezm/git-grab to /home/wmoore/src/github.com/wezm/git-grab
Cloning into '/home/wmoore/src/github.com/wezm/git-grab'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 30 (delta 9), reused 27 (delta 7), pack-reused 0
Receiving objects: 100% (30/30), 12.50 KiB | 12.50 MiB/s, done.
Resolving deltas: 100% (9/9), done.
Grabbed https://github.com/wezm/git-grab to /home/wmoore/src/github.com/wezm/git-grab

$ exa --tree ~/src
/home/wmoore/src
Expand Down
3 changes: 2 additions & 1 deletion src/grab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ pub fn grab(home: &Path, url: OsString, dry_run: bool) -> Result<(), Error> {
let url: Url = parse_url(str)?;

let dest_path = clone_path(home, &url)?;
println!("Grab {} to {}", url, dest_path.display());

if dry_run {
println!("Grab {} to {}", url, dest_path.display());
return Ok(());
}

Expand All @@ -29,6 +29,7 @@ pub fn grab(home: &Path, url: OsString, dry_run: bool) -> Result<(), Error> {
None => String::from("git killed by signal"),
})
.map_err(|err| err.into())
.map(|()| println!("Grabbed {} to {}", url, dest_path.display()))
}

fn parse_url(url: &str) -> Result<Url, Error> {
Expand Down

0 comments on commit 00ad1cf

Please sign in to comment.