diff options
| author | Paul Bütow <pbuetow@mimecast.com> | 2020-01-20 18:41:05 +0000 |
|---|---|---|
| committer | Paul Bütow <pbuetow@mimecast.com> | 2020-01-21 14:35:23 +0000 |
| commit | c128865c4c7411c29a59fca9a3a2f95537686d7b (patch) | |
| tree | 193bccc70d942c8b70cc93fae2670263701e43aa /omode | |
| parent | 3755a9911ecb05886577095f2b8cc8b9e4066a3a (diff) | |
Move commands to cmd/ and move internal dependencies to internal/
Diffstat (limited to 'omode')
| -rw-r--r-- | omode/mode.go | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/omode/mode.go b/omode/mode.go deleted file mode 100644 index 4bdfc45..0000000 --- a/omode/mode.go +++ /dev/null @@ -1,81 +0,0 @@ -package omode - -import ( - "fmt" - "os" - "path" -) - -// Mode used. -type Mode int - -// Possible modes. -const ( - Unknown Mode = iota - Server Mode = iota - TailClient Mode = iota - CatClient Mode = iota - GrepClient Mode = iota - MapClient Mode = iota - HealthClient 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: - return "server" - case TailClient: - return "tail" - case CatClient: - return "cat" - case GrepClient: - return "grep" - case MapClient: - return "map" - case HealthClient: - return "health" - default: - return "unknown" - } -} |
