github.com/dop251/modtools@v0.0.0-20220314120634-3b2fc95d1790/cmd/thaw.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/muesli/coral"
     5  )
     6  
     7  func init() {
     8  	rootCmd.AddCommand(&coral.Command{
     9  		Use:   "thaw modpath",
    10  		Short: "Un-freeze a dependency",
    11  		Long:  "Removes the specified module path from the list of exceptions.",
    12  		Args:  coral.ExactArgs(1),
    13  		RunE: func(cmd *coral.Command, args []string) error {
    14  			return thaw(args[0])
    15  		},
    16  	})
    17  }
    18  
    19  func thaw(p string) error {
    20  	e, err := loadExceptions()
    21  	if err != nil {
    22  		return err
    23  	}
    24  	e.Remove(p)
    25  	return e.Save()
    26  }