Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Commit

Permalink
✨ Only copy accounts into new profile if it is the first
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Oct 26, 2022
1 parent 1617a3d commit 3382f4c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions internal/profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,20 @@ func (p Profile) Create() error {
return err
}

var first bool
if _, err := List(); err != nil {
if !errors.Is(err, ErrNoneFound) {
return err
}
first = true
}

// Create profile hosts
if err := util.CopyFile(github.RootHostsPath(), p.HostsPath()); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
if first {
fmt.Println("ℹ️️ Copying existing account into profile")
if err := util.CopyFile(github.RootHostsPath(), p.HostsPath()); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
}

// Create profile config
Expand Down

0 comments on commit 3382f4c

Please sign in to comment.