@@ -14,6 +14,7 @@ import (
14
14
supervisor_helper "github.com/gitpod-io/gitpod/gitpod-cli/pkg/supervisor-helper"
15
15
"github.com/gitpod-io/gitpod/gitpod-cli/pkg/utils"
16
16
"github.com/gitpod-io/gitpod/supervisor/api"
17
+ supervisor "github.com/gitpod-io/gitpod/supervisor/api"
17
18
"github.com/spf13/cobra"
18
19
19
20
"github.com/olekukonko/tablewriter"
@@ -48,11 +49,36 @@ var listTasksCmd = &cobra.Command{
48
49
2 : tablewriter .FgHiBlackColor ,
49
50
}
50
51
52
+ mapCurrentToColor := map [bool ]int {
53
+ false : tablewriter .FgWhiteColor ,
54
+ true : tablewriter .FgHiGreenColor ,
55
+ }
56
+
57
+ ppid := int64 (os .Getppid ())
58
+
51
59
for _ , task := range tasks {
52
60
colors := []tablewriter.Colors {}
53
61
62
+ isCurrent := false
63
+
64
+ if task .State == api .TaskState_running {
65
+ terminalClient , err := supervisor_helper .GetTerminalServiceClient (context .Background ())
66
+ if err != nil {
67
+ log .Fatalf ("cannot get terminal service: %s" , err )
68
+ }
69
+
70
+ terminal , err := terminalClient .Get (context .Background (), & supervisor.GetTerminalRequest {Alias : task .Terminal })
71
+ if err != nil {
72
+ panic (err )
73
+ }
74
+
75
+ if ppid == terminal .Pid {
76
+ isCurrent = true
77
+ }
78
+ }
79
+
54
80
if ! noColor && utils .ColorsEnabled () {
55
- colors = []tablewriter.Colors {{}, {}, {mapStatusToColor [task .State ]}}
81
+ colors = []tablewriter.Colors {{mapCurrentToColor [ isCurrent ] }, {}, {mapStatusToColor [task .State ]}}
56
82
}
57
83
58
84
table .Rich ([]string {task .Terminal , task .Presentation .Name , task .State .String ()}, colors )
0 commit comments