Add pin and unpin commands/updated update command to work with pin & unpin (#234)

* Add pin and unpin commands/updated update command to work with pin & unpin

* Inline cobra functions
This commit is contained in:
joeyak
2023-06-24 20:38:03 -04:00
committed by GitHub
parent 0df199852f
commit dffdbc9b80
3 changed files with 104 additions and 2 deletions

View File

@@ -2,11 +2,12 @@ package cmd
import (
"fmt"
"os"
"github.com/packwiz/packwiz/cmdshared"
"github.com/packwiz/packwiz/core"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
)
// UpdateCmd represents the update command
@@ -77,6 +78,11 @@ var UpdateCmd = &cobra.Command{
continue
}
if check.UpdateAvailable {
if v[i].Pin {
fmt.Printf("Update skipped for pinned mod %s\n", v[i].Name)
continue
}
if !updatesFound {
fmt.Println("Updates found:")
updatesFound = true
@@ -133,6 +139,10 @@ var UpdateCmd = &cobra.Command{
fmt.Println(err)
os.Exit(1)
}
if modData.Pin {
fmt.Println("Version is pinned; run the unpin command to allow updating")
os.Exit(1)
}
singleUpdatedName = modData.Name
updaterFound := false
for k := range modData.Update {