Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
print plugins to the info Command (#1617)
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Mar 5, 2019
1 parent e7e460f commit 5ab2913
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions buffalo/cmd/info.go
Expand Up @@ -5,7 +5,9 @@ import (
"io"
"os"
"os/exec"
"path/filepath"
"reflect"
"strings"

"github.com/gobuffalo/buffalo/runtime"
"github.com/gobuffalo/envy"
Expand Down Expand Up @@ -43,10 +45,37 @@ var infoCmd = &cobra.Command{
if err := runInfoCmds(); err != nil {
return errors.WithStack(err)
}

if err := configs(app); err != nil {
return errors.WithStack(err)
}

return infoGoMod()
},
}

func configs(app meta.App) error {
bb := os.Stdout
root := filepath.Join(app.Root, "config")
return filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if info == nil || info.IsDir() {
return nil
}
f, err := os.Open(path)
if err != nil {
return errors.WithStack(err)
}
defer f.Close()
p := strings.TrimPrefix(path, app.Root)
p = strings.TrimPrefix(p, string(filepath.Separator))
bb.WriteString(fmt.Sprintf("\n### %s\n", p))
if _, err := io.Copy(bb, f); err != nil {
return errors.WithStack(err)
}
return nil
})
}

type infoCommand struct {
Name string
PathName string
Expand Down

0 comments on commit 5ab2913

Please sign in to comment.