Skip to content

Commit bb61c4c

Browse files
Akash-Patilmohammed786
authored andcommitted
Updated output for get config commands (#56)
1 parent 23e46ac commit bb61c4c

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

cmd/get/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func NewConfigCmd() *cobra.Command {
1717
`),
1818
Example: heredoc.Doc(`
1919
$ lr get config
20+
APP Name: <Your App Name>
2021
API Key: <Your API Key>
2122
API Secret: <Your API secret >
2223

cmd/get/schema/schema.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ func get() error {
6262
if v.Enabled {
6363
enabled = "true"
6464
}
65-
data = append(data, []string{k, v.Display, v.Type, enabled})
65+
Type := v.Type
66+
if Type == "multi" {
67+
Type = "checkbox"
68+
}
69+
data = append(data, []string{k, v.Display, Type, enabled})
6670
}
6771
sort.SliceStable(data, func(i, j int) bool {
6872
return data[i][3] == "true"

cmd/get/site/site.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ func NewSiteCmd() *cobra.Command {
2626
Example: heredoc.Doc(`
2727
$ lr get site --all
2828
All sites:
29-
+--------+-----------------+-------------------------+-----------+
30-
| ID | NAME | DOMAIN | PLAN |
31-
+--------+-----------------+-------------------------+-----------+
32-
| 111111 | new-test1 | https://mail7.io | free |
33-
| 122222 | my-app-final | loginradius.com | business |
34-
| 142670 | trail-pro | https://loginradius.com | business |
29+
+--------+-----------------+-------------------------+----------------+
30+
| ID | NAME | DOMAIN | PLAN |
31+
+--------+-----------------+-------------------------+----------------+
32+
| 111111 | new-test1 | https://mail7.io | free |
33+
| 122222 | my-app-final | loginradius.com | developer pro |
34+
| 142670 | trail-pro | https://loginradius.com | developer pro |
3535
3636
$ lr get site --active
3737
Current site:
@@ -70,7 +70,11 @@ func getSite() error {
7070
var data [][]string
7171
fmt.Println("All sites: ")
7272
for _, site := range AppInfo {
73-
data = append(data, []string{strconv.FormatInt(site.Appid, 10), site.Appname, site.Domain, site.Productplan.Name})
73+
ProductPlan := site.Productplan.Name
74+
if ProductPlan == "business" {
75+
ProductPlan = "developer pro"
76+
}
77+
data = append(data, []string{strconv.FormatInt(site.Appid, 10), site.Appname, site.Domain, ProductPlan})
7478
}
7579
table := tablewriter.NewWriter(os.Stdout)
7680
table.SetHeader([]string{"ID", "Name", "Domain", "Plan"})

0 commit comments

Comments
 (0)