buffalo-plugins: github.com/gobuffalo/buffalo-plugins/cmd/internal/cache Index | Files

package cache

import "github.com/gobuffalo/buffalo-plugins/cmd/internal/cache"

Index

Package Files

build.go clean.go list.go

Variables

var BuildCmd = &cobra.Command{
    Use:   "build",
    Short: "rebuilds the plugins cache",
    RunE: func(cmd *cobra.Command, args []string) error {
        os.RemoveAll(plugins.CachePath)
        _, err := plugins.Available()
        return err
    },
}

cacheCmd represents the cache command

var CleanCmd = &cobra.Command{
    Use:   "clean",
    Short: "cleans the plugins cache",
    RunE: func(cmd *cobra.Command, args []string) error {
        os.RemoveAll(plugins.CachePath)
        return nil
    },
}

cacheCmd represents the cache command

var ListCmd = &cobra.Command{
    Use:   "list",
    Short: "displays the contents of the plugin cache",
    RunE: func(cmd *cobra.Command, args []string) error {
        b, err := ioutil.ReadFile(plugins.CachePath)
        if err != nil {
            return errors.WithStack(err)
        }
        m := map[string]interface{}{}
        err = json.Unmarshal(b, &m)
        if err != nil {
            return errors.WithStack(err)
        }
        is, err := json.MarshalIndent(m, "", "  ")
        if err != nil {
            return errors.WithStack(err)
        }

        fmt.Println(string(is))
        return nil
    },
}

cacheCmd represents the cache command

Package cache imports 7 packages (graph) and is imported by 1 packages. Updated 2019-03-26. Refresh now. Tools for package owners.