add --connector switch, validation

This commit is contained in:
Bradley Cicenas
2017-06-09 17:35:29 +00:00
parent eeac65da8c
commit d372043a17
5 changed files with 28 additions and 8 deletions

View File

@@ -8,16 +8,20 @@ import (
ui "github.com/gizak/termui"
)
var enabledConnectors = map[string]func() connector.Connector{
"docker": connector.NewDocker,
"runc": connector.NewRunc,
}
type GridCursor struct {
selectedID string // id of currently selected container
filtered container.Containers
cSource connector.ContainerSource
cSource connector.Connector
}
func NewGridCursor() *GridCursor {
func NewGridCursor(connector string) *GridCursor {
return &GridCursor{
cSource: connector.NewRunc(),
//cSource: connector.NewDocker(),
cSource: enabledConnectors[connector](),
}
}