Add hold/unhold aliases, tweak help msg, remove unused param

This commit is contained in:
comp500 2023-06-25 01:41:01 +01:00
parent dffdbc9b80
commit e8c28ae57e

View File

@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func pinMod(cmd *cobra.Command, args []string, pinned bool) { func pinMod(args []string, pinned bool) {
fmt.Println("Loading modpack...") fmt.Println("Loading modpack...")
pack, err := core.LoadPack() pack, err := core.LoadPack()
if err != nil { if err != nil {
@ -67,20 +67,22 @@ func pinMod(cmd *cobra.Command, args []string, pinned bool) {
// pinCmd represents the pin command // pinCmd represents the pin command
var pinCmd = &cobra.Command{ var pinCmd = &cobra.Command{
Use: "pin", Use: "pin",
Short: "Pin a mod to the current version", Short: "Pin a file so it does not get updated automatically",
Aliases: []string{"hold"},
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
pinMod(cmd, args, true) pinMod(args, true)
}, },
} }
// unpinCmd represents the unpin command // unpinCmd represents the unpin command
var unpinCmd = &cobra.Command{ var unpinCmd = &cobra.Command{
Use: "unpin", Use: "unpin",
Short: "Unpin a mod from the current version", Short: "Unpin a file so it receives updates",
Aliases: []string{"unhold"},
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
pinMod(cmd, args, false) pinMod(args, false)
}, },
} }