github.com/wawandco/ox@v0.13.6-0.20230809142027-913b3d837f2a/plugins/base/new/tinit_test.go (about) 1 package new_test 2 3 import ( 4 "context" 5 6 "github.com/spf13/pflag" 7 "github.com/wawandco/ox/plugins/base/new" 8 ) 9 10 var _ new.Initializer = (*Tinit)(nil) 11 var _ new.AfterInitializer = (*Tinit)(nil) 12 13 type Tinit struct { 14 afterCalled bool 15 called bool 16 17 root string 18 folder string 19 name string 20 } 21 22 func (t Tinit) Name() string { return "tinit" } 23 24 func (t *Tinit) Initialize(ctx context.Context, options new.Options) error { 25 t.called = true 26 t.folder = options.Folder 27 t.root = options.Root 28 t.name = options.Name 29 30 return nil 31 } 32 33 func (t *Tinit) AfterInitialize(ctx context.Context, options new.Options) error { 34 t.afterCalled = true 35 t.root = options.Root 36 37 return nil 38 } 39 40 func (t *Tinit) ParseFlags([]string) {} 41 func (t *Tinit) Flags() *pflag.FlagSet { 42 return pflag.NewFlagSet("tinit", pflag.ContinueOnError) 43 }