mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
update container, add collect methods and main entrypoint
This commit is contained in:
30
main.go
Normal file
30
main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/fsouza/go-dockerclient"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("no container provided")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
client, err := docker.NewClient("tcp://127.0.0.1:4243")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
g := &Grid{make(map[string]*Container)}
|
||||
g.AddContainer(os.Args[1])
|
||||
|
||||
for _, c := range g.containers {
|
||||
c.Collect(client)
|
||||
}
|
||||
|
||||
Display(g)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user