github.com/singlemusic/buffalo@v0.16.30/buffalo/cmd/plugins/internal/cache/list.go (about) 1 package cache 2 3 import ( 4 "encoding/json" 5 "fmt" 6 "io/ioutil" 7 8 "github.com/gobuffalo/buffalo/plugins" 9 "github.com/spf13/cobra" 10 ) 11 12 // ListCmd displays the contents of the plugin cache 13 var ListCmd = &cobra.Command{ 14 Use: "list", 15 Short: "displays the contents of the plugin cache", 16 RunE: func(cmd *cobra.Command, args []string) error { 17 b, err := ioutil.ReadFile(plugins.CachePath) 18 if err != nil { 19 return err 20 } 21 m := map[string]interface{}{} 22 err = json.Unmarshal(b, &m) 23 if err != nil { 24 return err 25 } 26 is, err := json.MarshalIndent(m, "", " ") 27 if err != nil { 28 return err 29 } 30 31 fmt.Println(string(is)) 32 return nil 33 }, 34 }