From 53ec5c911a1724a545e95c58a8d575c252d0dea6 Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Mon, 26 Oct 2020 11:38:17 +0000 Subject: [PATCH] return static error on unimplemented manager actions --- README.md | 2 +- connector/manager/main.go | 4 ++++ connector/manager/mock.go | 14 +++++++------- connector/manager/runc.go | 14 +++++++------- main.go | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 531ed52..93dfecd 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Option | Description `-s` | select initial container sort field `-scale-cpu` | show cpu as % of system total `-v` | output version information and exit -`-shell` | specify shell (default: sh) +`-shell` | exec shell to use (default: sh) ### Keybindings diff --git a/connector/manager/main.go b/connector/manager/main.go index f65aad3..1fcae1d 100644 --- a/connector/manager/main.go +++ b/connector/manager/main.go @@ -1,5 +1,9 @@ package manager +import "errors" + +var ActionNotImplErr = errors.New("action not implemented") + type Manager interface { Start() error Stop() error diff --git a/connector/manager/mock.go b/connector/manager/mock.go index f6fd62f..0438f86 100644 --- a/connector/manager/mock.go +++ b/connector/manager/mock.go @@ -7,29 +7,29 @@ func NewMock() *Mock { } func (m *Mock) Start() error { - return nil + return ActionNotImplErr } func (m *Mock) Stop() error { - return nil + return ActionNotImplErr } func (m *Mock) Remove() error { - return nil + return ActionNotImplErr } func (m *Mock) Pause() error { - return nil + return ActionNotImplErr } func (m *Mock) Unpause() error { - return nil + return ActionNotImplErr } func (m *Mock) Restart() error { - return nil + return ActionNotImplErr } func (m *Mock) Exec(cmd []string) error { - return nil + return ActionNotImplErr } diff --git a/connector/manager/runc.go b/connector/manager/runc.go index 07a4b58..c4dd277 100644 --- a/connector/manager/runc.go +++ b/connector/manager/runc.go @@ -7,29 +7,29 @@ func NewRunc() *Runc { } func (rc *Runc) Start() error { - return nil + return ActionNotImplErr } func (rc *Runc) Stop() error { - return nil + return ActionNotImplErr } func (rc *Runc) Remove() error { - return nil + return ActionNotImplErr } func (rc *Runc) Pause() error { - return nil + return ActionNotImplErr } func (rc *Runc) Unpause() error { - return nil + return ActionNotImplErr } func (rc *Runc) Restart() error { - return nil + return ActionNotImplErr } func (rc *Runc) Exec(cmd []string) error { - return nil + return ActionNotImplErr } diff --git a/main.go b/main.go index cd6a184..fc95f61 100644 --- a/main.go +++ b/main.go @@ -46,7 +46,7 @@ func main() { invertFlag = flag.Bool("i", false, "invert default colors") scaleCpu = flag.Bool("scale-cpu", false, "show cpu as % of system total") connectorFlag = flag.String("connector", "docker", "container connector to use") - defaultShell = flag.String("shell", "", "default shell") + defaultShell = flag.String("shell", "sh", "exec shell to use") ) flag.Parse()