Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Aug 9, 2019
1 parent 0c5d0bc commit 5c21f35
Showing 92 changed files with 2,857 additions and 2,314 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ install: true

env:
- GO111MODULE=on
- GOPROXY=https://proxy.golang.org

script:
- go build
4 changes: 2 additions & 2 deletions cmd/info.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (

"github.com/derailed/k9s/internal/color"
"github.com/derailed/k9s/internal/config"
"github.com/derailed/k9s/internal/views"
"github.com/derailed/k9s/internal/ui"
"github.com/spf13/cobra"
)

@@ -30,7 +30,7 @@ func printInfo() {
}

func printLogo(c color.Paint) {
for _, l := range views.LogoSmall {
for _, l := range ui.LogoSmall {
fmt.Println(color.Colorize(l, c))
}
fmt.Println()
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -26,14 +26,14 @@ replace (
)

require (
github.com/derailed/tview v0.1.12
github.com/derailed/tview v0.2.0
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/evanphx/json-patch v4.1.0+incompatible // indirect
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.7
github.com/gdamore/tcell v1.1.1
github.com/gdamore/tcell v1.1.2
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
64 changes: 36 additions & 28 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/config/style.go
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ func newTitle() Title {
BgColor: "black",
HighlightColor: "fuchsia",
CounterColor: "papayawhip",
FilterColor: "steelblue",
FilterColor: "orange",
}
}

6 changes: 3 additions & 3 deletions internal/resource/pod.go
Original file line number Diff line number Diff line change
@@ -143,6 +143,7 @@ func (r *Pod) PodLogs(ctx context.Context, c chan<- string, opts LogOptions) err
if in(rcos, co.Name) {
opts.Container = co.Name
if err := r.Logs(ctx, c, opts); err != nil {
log.Error().Err(err).Msgf("Getting logs for %s failed", co.Name)
return err
}
}
@@ -160,6 +161,7 @@ func (r *Pod) Logs(ctx context.Context, c chan<- string, opts LogOptions) error
if !ok {
return fmt.Errorf("Resource %T is not Loggable", r.Resource)
}

return tailLogs(ctx, res, c, opts)
}

@@ -467,9 +469,7 @@ func checkContainerStatus(cs v1.ContainerStatus, i, initCount int) string {
func (r *Pod) loggableContainers(s v1.PodStatus) []string {
var rcos []string
for _, c := range s.ContainerStatuses {
if c.State.Running != nil || c.State.Terminated != nil {
rcos = append(rcos, c.Name)
}
rcos = append(rcos, c.Name)
}
return rcos
}
51 changes: 51 additions & 0 deletions internal/ui/action.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package ui

import (
"sort"

"github.com/gdamore/tcell"
"github.com/rs/zerolog/log"
)

type (
// ActionHandler handles a keyboard command.
ActionHandler func(*tcell.EventKey) *tcell.EventKey

// KeyAction represents a keyboard action.
KeyAction struct {
Description string
Action ActionHandler
Visible bool
}

// KeyActions tracks mappings between keystrokes and actions.
KeyActions map[tcell.Key]KeyAction
)

// NewKeyAction returns a new keyboard action.
func NewKeyAction(d string, a ActionHandler, display bool) KeyAction {
return KeyAction{Description: d, Action: a, Visible: display}
}

// Hints returns a collection of hints.
func (a KeyActions) Hints() Hints {
kk := make([]int, 0, len(a))
for k, v := range a {
if v.Visible {
kk = append(kk, int(k))
}
}
sort.Ints(kk)

hh := make(Hints, 0, len(kk))
for _, k := range kk {
if name, ok := tcell.KeyNames[tcell.Key(k)]; ok {
hh = append(hh, Hint{
mnemonic: name,
description: a[tcell.Key(k)].Description})
} else {
log.Error().Msgf("Unable to locate KeyName for %#v", string(k))
}
}
return hh
}
Loading

0 comments on commit 5c21f35

Please sign in to comment.