add headers when using raw output (#1087)
* add headers when output raw with cscli
This commit is contained in:
parent
4c306187a6
commit
01130a5e17
|
@ -144,6 +144,7 @@ Note: This command requires database direct access, so is intended to be run on
|
||||||
}
|
}
|
||||||
fmt.Printf("%s", string(x))
|
fmt.Printf("%s", string(x))
|
||||||
} else if csConfig.Cscli.Output == "raw" {
|
} else if csConfig.Cscli.Output == "raw" {
|
||||||
|
fmt.Printf("machine_id,ip_address,updated_at,validated,version\n")
|
||||||
for _, w := range machines {
|
for _, w := range machines {
|
||||||
var validated string
|
var validated string
|
||||||
if w.IsValidated {
|
if w.IsValidated {
|
||||||
|
|
|
@ -131,8 +131,12 @@ func ListItem(itemType string, args []string) {
|
||||||
}
|
}
|
||||||
fmt.Printf("%s", string(x))
|
fmt.Printf("%s", string(x))
|
||||||
} else if csConfig.Cscli.Output == "raw" {
|
} else if csConfig.Cscli.Output == "raw" {
|
||||||
|
fmt.Printf("name,status,version,description\n")
|
||||||
for _, v := range hubStatus {
|
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"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,9 +226,9 @@ install_collection() {
|
||||||
HMENU=()
|
HMENU=()
|
||||||
readarray -t AVAILABLE_COLLECTION < <(${CSCLI_BIN_INSTALLED} collections list -o raw -a)
|
readarray -t AVAILABLE_COLLECTION < <(${CSCLI_BIN_INSTALLED} collections list -o raw -a)
|
||||||
COLLECTION_TO_INSTALL=()
|
COLLECTION_TO_INSTALL=()
|
||||||
for collect_info in "${AVAILABLE_COLLECTION[@]}"; do
|
for collect_info in "${AVAILABLE_COLLECTION[@]:1}"; do
|
||||||
collection="$(echo ${collect_info} | cut -d " " -f1)"
|
collection="$(echo ${collect_info} | cut -d "," -f1)"
|
||||||
description="$(echo ${collect_info} | cut -d " " -f2-)"
|
description="$(echo ${collect_info} | cut -d "," -f4)"
|
||||||
in_array $collection "${DETECTED_SERVICES[@]}"
|
in_array $collection "${DETECTED_SERVICES[@]}"
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
HMENU+=("${collection}" "${description}" "ON")
|
HMENU+=("${collection}" "${description}" "ON")
|
||||||
|
|
Loading…
Reference in a new issue