mirror of
https://gitea.elkins.co/Networking/ccl.git
synced 2025-03-09 12:41:40 -05:00
ls: add CREATED and RUNNING columns
This commit is contained in:
parent
b758f04a50
commit
53272b0da9
18
cmd/ls.go
18
cmd/ls.go
@ -44,12 +44,24 @@ ccl ls default sub # multiple ok
|
|||||||
ccl ls squid`,
|
ccl ls squid`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
conts := config.Union(args)
|
conts := config.Union(args)
|
||||||
w := tabwriter.NewWriter(cmd.OutOrStdout(), 0, 0, 4, ' ', 0)
|
w := tabwriter.NewWriter(cmd.OutOrStdout(), 0, 0, 2, ' ', 0)
|
||||||
defer w.Flush()
|
defer w.Flush()
|
||||||
|
|
||||||
fmt.Fprintf(w, "CATEGORY\tNAME\tIMAGE\tRUNNING\n")
|
titlemsg := "CATEGORY\tNAME\tIMAGE\tCREATED\tRUNNING"
|
||||||
|
fmt.Fprintf(w, "%s\n", titlemsg)
|
||||||
for _, c := range conts {
|
for _, c := range conts {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", c.Category, c.Name, c.Image, c.IsRunning())
|
data := []interface{}{c.Category, c.Name, c.Image}
|
||||||
|
if c.IsCreated() {
|
||||||
|
data = append(data, "YES")
|
||||||
|
} else {
|
||||||
|
data = append(data, "")
|
||||||
|
}
|
||||||
|
if c.IsRunning() {
|
||||||
|
data = append(data, "YES")
|
||||||
|
} else {
|
||||||
|
data = append(data, "")
|
||||||
|
}
|
||||||
|
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", data...)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user