add headers when using raw output (#1087)

* add headers when output raw with cscli
This commit is contained in:
AlteredCoder 2021-12-14 11:09:26 +01:00 committed by GitHub
parent 4c306187a6
commit 01130a5e17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -131,8 +131,12 @@ func ListItem(itemType string, args []string) {
}
fmt.Printf("%s", string(x))
} else if csConfig.Cscli.Output == "raw" {
fmt.Printf("name,status,version,description\n")
for _, v := range hubStatus {
fmt.Printf("%s %s\n", v["name"], v["description"])
if v["local_version"] == "" {
v["local_version"] = "n/a"
}
fmt.Printf("%s,%s,%s,%s\n", v["name"], v["status"], v["local_version"], v["description"])
}
}
}