summaryrefslogtreecommitdiffstats
path: root/pkg/gui/main_panels.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-03-31 23:55:06 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-04-02 11:00:15 +1100
commit7d62f103e4a1b39b7e8fbd0e1f39815c525cd588 (patch)
tree83e331beeee07d066c76580e044234f18063a0a7 /pkg/gui/main_panels.go
parent9e85d37fb949bbc83f28cb079f2ac4b45ae895ce (diff)
big refactor to give our enums actual types
Diffstat (limited to 'pkg/gui/main_panels.go')
-rw-r--r--pkg/gui/main_panels.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/pkg/gui/main_panels.go b/pkg/gui/main_panels.go
index b0098f5e9..8a34ddfa5 100644
--- a/pkg/gui/main_panels.go
+++ b/pkg/gui/main_panels.go
@@ -20,8 +20,10 @@ type refreshMainOpts struct {
}
// constants for updateTask's kind field
+type TaskKind int
+
const (
- RENDER_STRING = iota
+ RENDER_STRING TaskKind = iota
RENDER_STRING_WITHOUT_SCROLL
RUN_FUNCTION
RUN_COMMAND
@@ -29,14 +31,14 @@ const (
)
type updateTask interface {
- GetKind() int
+ GetKind() TaskKind
}
type renderStringTask struct {
str string
}
-func (t *renderStringTask) GetKind() int {
+func (t *renderStringTask) GetKind() TaskKind {
return RENDER_STRING
}
@@ -48,7 +50,7 @@ type renderStringWithoutScrollTask struct {
str string
}
-func (t *renderStringWithoutScrollTask) GetKind() int {
+func (t *renderStringWithoutScrollTask) GetKind() TaskKind {
return RENDER_STRING_WITHOUT_SCROLL
}
@@ -61,7 +63,7 @@ type runCommandTask struct {
prefix string
}
-func (t *runCommandTask) GetKind() int {
+func (t *runCommandTask) GetKind() TaskKind {
return RUN_COMMAND
}
@@ -78,7 +80,7 @@ type runPtyTask struct {
prefix string
}
-func (t *runPtyTask) GetKind() int {
+func (t *runPtyTask) GetKind() TaskKind {
return RUN_PTY
}
@@ -95,7 +97,7 @@ type runFunctionTask struct {
f func(chan struct{}) error
}
-func (t *runFunctionTask) GetKind() int {
+func (t *runFunctionTask) GetKind() TaskKind {
return RUN_FUNCTION
}