Skip to content

Commit

Permalink
Merge branch 'development' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Bence Babós committed Sep 29, 2020
2 parents be037ab + ce87b52 commit b0ce3dc
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 21 deletions.
3 changes: 2 additions & 1 deletion cmd/docker/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package docker
import (
"context"
"log"
"strings"
"time"

"github.com/bbabos/swarmon/cmd/utils"
Expand Down Expand Up @@ -36,7 +37,7 @@ func GetContainers() []Container {

for i, container := range containers {
conts[i].ID = container.ID[:12]
conts[i].Name = container.Names[0]
conts[i].Name = strings.TrimPrefix(container.Names[0], "/")
conts[i].State = container.State
conts[i].Created = time.Unix(container.Created, 0).Format("2006-01-02 15:04:05")
}
Expand Down
3 changes: 0 additions & 3 deletions cmd/page/containerPage.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package page

import (
"fmt"

"github.com/bbabos/swarmon/cmd/docker"
)

Expand Down Expand Up @@ -35,5 +33,4 @@ func containerSubPage(c docker.IContainer) {
},
}
page.render()
defer fmt.Println("----------------------------------------------")
}
3 changes: 0 additions & 3 deletions cmd/page/nodePage.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package page

import (
"fmt"

"github.com/bbabos/swarmon/cmd/docker"
)

Expand Down Expand Up @@ -37,5 +35,4 @@ func nodeSubPage(n docker.INode) {
},
}
page.render()
defer fmt.Println("----------------------------------------------")
}
4 changes: 2 additions & 2 deletions cmd/page/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (p mainPage) render() {

func (p mainPage) renderBase() int {
prompt := promptui.Select{
Label: p.title,
Label: "----- " + p.title + " -----",
Items: p.items,
Templates: &promptui.SelectTemplates{
Label: "{{ . }}",
Expand All @@ -51,7 +51,7 @@ func (p mainPage) renderBase() int {

func (p dynamicPage) renderBase() int {
prompt := promptui.Select{
Label: p.title,
Label: "----- " + p.title + " -----",
Items: p.items,
Templates: &promptui.SelectTemplates{
Label: "{{ . }}",
Expand Down
3 changes: 0 additions & 3 deletions cmd/page/servicePage.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package page

import (
"fmt"

"github.com/bbabos/swarmon/cmd/docker"
)

Expand Down Expand Up @@ -37,5 +35,4 @@ func serviceSubPage(s docker.IService) {
},
}
page.render()
defer fmt.Println("----------------------------------------------")
}
4 changes: 1 addition & 3 deletions cmd/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ func ExecShellCommand(command string, showOutput bool) {
func ExitOnKeystroke(menu func()) {
loop:
for {
fmt.Println("----------------------------------------------")
fmt.Println("Press q to exit!")
fmt.Println("----------------------------------------------")
fmt.Print("Press q to exit! ")
char, _, err := keyboard.GetSingleKey()
if err != nil {
log.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
golang.org/x/net v0.0.0-20200923182212-328152dc79b1 // indirect
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d // indirect
golang.org/x/net v0.0.0-20200927032502-5d4f70055728 // indirect
golang.org/x/sys v0.0.0-20200926100807-9d91bd62050c // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200923182212-328152dc79b1 h1:Iu68XRPd67wN4aRGGWwwq6bZo/25jR6uu52l/j2KkUE=
golang.org/x/net v0.0.0-20200923182212-328152dc79b1/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200927032502-5d4f70055728 h1:5wtQIAulKU5AbLQOkjxl32UufnIOqgBX72pS0AV14H0=
golang.org/x/net v0.0.0-20200927032502-5d4f70055728/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -76,8 +76,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d h1:L/IKR6COd7ubZrs2oTnTi73IhgqJ71c9s80WsQnh0Es=
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200926100807-9d91bd62050c h1:38q6VNPWR010vN82/SB121GujZNIfAUb4YttE2rhGuc=
golang.org/x/sys v0.0.0-20200926100807-9d91bd62050c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down

0 comments on commit b0ce3dc

Please sign in to comment.