github.com/gobuffalo/buffalo-cli/v2@v2.0.0-alpha.15.0.20200919213536-a7350c8e6799/cli/cmds/info/main.go (about)

     1  package info
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/gobuffalo/plugins"
     7  )
     8  
     9  // Main implements the `buffalo info` command. Buffalo's checks
    10  // are run first, then any plugins that implement plugins.Informer
    11  // will be run in order at the end.
    12  func (cmd *Cmd) Main(ctx context.Context, root string, args []string) error {
    13  	plugs := cmd.ScopedPlugins()
    14  
    15  	if p := FindInformerFromArgs(args, plugs); p != nil {
    16  		return p.Info(ctx, root, args[1:])
    17  	}
    18  
    19  	for _, p := range plugs {
    20  		if i, ok := p.(Informer); ok {
    21  			if err := i.Info(ctx, root, args); err != nil {
    22  				return plugins.Wrap(i, err)
    23  			}
    24  		}
    25  	}
    26  	return nil
    27  }