diff options
| author | Paul Bütow <pbuetow@mimecast.com> | 2020-01-22 13:07:04 +0000 |
|---|---|---|
| committer | Paul Bütow <pbuetow@mimecast.com> | 2020-01-22 13:07:04 +0000 |
| commit | bd683ec4a63b01255274ab6f2463c95a49695e90 (patch) | |
| tree | 9c397b2edc9e118aac563abdfa78211a9f3d3938 /internal/omode | |
| parent | e56c31af93c5432eab8c129e19d8741db1e19a32 (diff) | |
more on dexec
Diffstat (limited to 'internal/omode')
| -rw-r--r-- | internal/omode/mode.go | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/internal/omode/mode.go b/internal/omode/mode.go index 4bdfc45..57366d2 100644 --- a/internal/omode/mode.go +++ b/internal/omode/mode.go @@ -1,11 +1,5 @@ package omode -import ( - "fmt" - "os" - "path" -) - // Mode used. type Mode int @@ -18,49 +12,9 @@ const ( GrepClient Mode = iota MapClient Mode = iota HealthClient Mode = iota + ExecClient Mode = iota ) -// New returns the mode based on the mode string. -func New(modeStr string) Mode { - switch modeStr { - case "dserver": - return Server - case "server": - return Server - - case "dtail": - fallthrough - case "tail": - return TailClient - - case "grep": - fallthrough - case "dgrep": - return GrepClient - - case "cat": - fallthrough - case "dcat": - return CatClient - - case "map": - fallthrough - case "dmap": - return MapClient - - case "health": - return HealthClient - - default: - panic(fmt.Sprintf("Unknown mode: '%s'", modeStr)) - } -} - -// Default mode. -func Default() Mode { - return New(path.Base(os.Args[0])) -} - func (m Mode) String() string { switch m { case Server: @@ -75,6 +29,8 @@ func (m Mode) String() string { return "map" case HealthClient: return "health" + case ExecClient: + return "exec" default: return "unknown" } |
