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

     1  package newapp
     2  
     3  import (
     4  	"context"
     5  	"os/exec"
     6  )
     7  
     8  var _ AfterNewapper = afternewapper(nil)
     9  var _ Newapper = newapper(nil)
    10  var _ NewCommandRunner = cmdRunner(nil)
    11  
    12  type newapper func(ctx context.Context, root string, name string, args []string) error
    13  
    14  func (fn newapper) PluginName() string {
    15  	return "newapper"
    16  }
    17  
    18  func (fn newapper) Newapp(ctx context.Context, root string, name string, args []string) error {
    19  	return fn(ctx, root, name, args)
    20  }
    21  
    22  type afternewapper func(ctx context.Context, root string, name string, args []string, err error) error
    23  
    24  func (fn afternewapper) PluginName() string {
    25  	return "after-newapper"
    26  }
    27  
    28  func (fn afternewapper) AfterNewapp(ctx context.Context, root string, name string, args []string, err error) error {
    29  	return fn(ctx, root, name, args, err)
    30  }
    31  
    32  type cmdRunner func(ctx context.Context, root string, cmd *exec.Cmd) error
    33  
    34  func (fn cmdRunner) PluginName() string {
    35  	return "cmd-runner"
    36  }
    37  
    38  func (fn cmdRunner) RunNewCommand(ctx context.Context, root string, cmd *exec.Cmd) error {
    39  	return fn(ctx, root, cmd)
    40  }