github.com/kristofferahl/go-centry@v1.5.0/cmd/centry/context.go (about) 1 package main 2 3 import ( 4 "github.com/kristofferahl/go-centry/internal/pkg/config" 5 "github.com/kristofferahl/go-centry/internal/pkg/io" 6 "github.com/kristofferahl/go-centry/internal/pkg/log" 7 ) 8 9 // Executor is the name of the executor 10 type Executor string 11 12 // CLI executor 13 var CLI Executor = "CLI" 14 15 // API Executor 16 var API Executor = "API" 17 18 // Context defines the current context 19 type Context struct { 20 executor Executor 21 io io.InputOutput 22 log *log.Manager 23 manifest *config.Manifest 24 commandEnabledFunc func(config.Command) bool 25 optionEnabledFunc func(config.Option) bool 26 } 27 28 // NewContext creates a new context 29 func NewContext(executor Executor, io io.InputOutput) *Context { 30 return &Context{ 31 executor: executor, 32 io: io, 33 } 34 }