Skip to content

Commit

Permalink
Add DB credential command info on list/show command output
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Thakur <harsh@civo.com>
  • Loading branch information
Harsh Thakur authored and RealHarshThakur committed Jan 16, 2023
1 parent 554083d commit 968f695
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/database/database_list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package database

import (
"fmt"
"os"
"strconv"

Expand Down Expand Up @@ -43,7 +44,7 @@ var dbListCmd = &cobra.Command{
ow.AppendDataWithLabel("nodes", strconv.Itoa(db.Nodes), "Nodes")
ow.AppendDataWithLabel("software", db.Software, "Software")
ow.AppendDataWithLabel("software_version", db.SoftwareVersion, "Software Version")
ow.AppendDataWithLabel("public_ip", db.PublicIPv4, "Public IPv4")
ow.AppendDataWithLabel("Host", fmt.Sprintf("%s:%d", db.PublicIPv4, db.Port), "Host")
ow.AppendDataWithLabel("status", db.Status, "Status")

if common.OutputFormat == "json" || common.OutputFormat == "custom" {
Expand All @@ -61,6 +62,7 @@ var dbListCmd = &cobra.Command{
ow.WriteCustomOutput(common.OutputFields)
default:
ow.WriteTable()
fmt.Println("To get the credentials for a database, use `civo db credential <name/ID>`")
}
},
}
3 changes: 2 additions & 1 deletion cmd/database/database_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var dbShowCmd = &cobra.Command{
ow.AppendDataWithLabel("nodes", strconv.Itoa(db.Nodes), "Nodes")
ow.AppendDataWithLabel("software", db.Software, "Software")
ow.AppendDataWithLabel("software_version", db.SoftwareVersion, "Software Version")
ow.AppendDataWithLabel("public_ip", db.PublicIPv4, "Public IPv4")
ow.AppendDataWithLabel("host", fmt.Sprintf("%s:%d", db.PublicIPv4, db.Port), "Host")

if common.OutputFormat == "json" || common.OutputFormat == "custom" {
ow.AppendDataWithLabel("firewall_id", db.FirewallID, "Firewall ID")
Expand All @@ -64,6 +64,7 @@ var dbShowCmd = &cobra.Command{
ow.WriteCustomOutput(common.OutputFields)
default:
ow.WriteKeyValues()
fmt.Println("To get the credentials, run : civo db credential", db.Name)
}
},
}

0 comments on commit 968f695

Please sign in to comment.