Add basic interactive overwrite strategy

Available options:

- Do not copy
- Overwrite dest
- Copy source as dest.dist
This commit is contained in:
2020-05-23 11:56:44 +02:00
parent 6aaa82efa4
commit 0fa845b3ff
9 changed files with 154 additions and 20 deletions

View File

@ -1,7 +1,7 @@
package project
import (
"log"
"fmt"
"net/url"
"os"
"strings"
@ -51,7 +51,7 @@ func (f *GitFetcher) Fetch(url *url.URL) (billy.Filesystem, error) {
url.Fragment = ""
}
log.Printf("Cloning repository '%s'...", url.String())
fmt.Printf("Cloning repository '%s'.\n", url.String())
repo, err := git.Clone(memory.NewStorage(), fs, &git.CloneOptions{
URL: url.String(),
@ -72,7 +72,7 @@ func (f *GitFetcher) Fetch(url *url.URL) (billy.Filesystem, error) {
return nil, errors.Wrap(err, "could not retrieve worktree")
}
log.Printf("Checking out branch '%s'...", branchName)
fmt.Printf("Checking out branch '%s'.\n", branchName)
err = worktree.Checkout(&git.CheckoutOptions{
Force: true,