MCPcopy Create free account
hub / github.com/catppuccin/cli / PullUpdates

Function PullUpdates

internal/utils/network.go:24–47  ·  view source on GitHub ↗

PullUpdates opens a git repo and pulls the latest changes.

(repo string)

Source from the content-addressed store, hash-verified

22
23// PullUpdates opens a git repo and pulls the latest changes.
24func PullUpdates(repo string) {
25 // Repo should be a valid folder, so now we'll open the .git
26 r, err := git.PlainOpen(repo) // Open new repo targeting the .git folder
27 if err != nil {
28 // fmt.Printf("Error opening repo folder: %s\n", err)
29 log.Errorf("Error opening repo folder.")
30 } else {
31 // Get working directory
32 w, err := r.Worktree()
33 if err != nil {
34 // fmt.Printf("Error getting working directory: %s\n", err)
35 log.Fatalf("Error getting working directory")
36 } else {
37 // Pull the latest changes from origin
38 // fmt.Printf("Pulling latest changes for %s...\n", repo)
39 log.Infof("Pulling latest changes for %s...", repo)
40 err = w.Pull(&git.PullOptions{RemoteName: "origin"})
41 if err != nil {
42 // fmt.Printf("Failed to pull updates: %s\n", err)
43 log.Fatalf("Failed to pull updates")
44 }
45 }
46 }
47}
48
49// UpdateJSON makes a search request for all Catppuccin repos and caches them.
50func UpdateJSON() {

Callers 1

updaterFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected