Skip to content

Commit deead0c

Browse files
Akash-Patilravitejag
authored andcommitted
Fixed bugs and inputs in site commands (#33)
1 parent 63c0c6c commit deead0c

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

cmd/add/hooks/hooks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func addHooks() error {
5757

5858
func input() bool {
5959
fmt.Printf("Enter Name: ")
60-
fmt.Scanf("%s", &Name)
60+
fmt.Scanf("%s\n", &Name)
6161
if Name == "" {
6262
fmt.Println("Name is a required entry")
6363
return false
@@ -76,15 +76,15 @@ func input() bool {
7676
fmt.Println("3 - ResetPassword")
7777
fmt.Println("4 - UpdateProfile")
7878
fmt.Printf("Option: ")
79-
fmt.Scanf("%s", &eventOption)
79+
fmt.Scanf("%s\n", &eventOption)
8080
if eventOption == "" {
8181
fmt.Println("Event is a required entry")
8282
return false
8383
}
8484
Event = event[eventOption]
8585

8686
fmt.Printf("Enter TargetUrl: ")
87-
fmt.Scanf("%s", &TargetUrl)
87+
fmt.Scanf("%s\n", &TargetUrl)
8888
if TargetUrl == "" {
8989
fmt.Println("TargetUrl is a required entry")
9090
return false

cmd/add/site/site.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"net/http"
8+
"strconv"
89

910
"github.com/MakeNowJust/heredoc"
1011
"github.com/loginradius/lr-cli/api"
@@ -77,13 +78,13 @@ func addSite() error {
7778

7879
func input() bool {
7980
fmt.Printf("Enter the App Name: ")
80-
fmt.Scanf("%s", &AppName)
81+
fmt.Scanf("%s\n", &AppName)
8182
if AppName == "" {
8283
fmt.Println("App Name is a required entry")
8384
return false
8485
}
8586
fmt.Printf("Enter the Domain: ")
86-
fmt.Scanf("%s", &Domain)
87+
fmt.Scanf("%s\n", &Domain)
8788
if Domain == "" {
8889
fmt.Println("Domain is a required entry")
8990
return false
@@ -93,12 +94,12 @@ func input() bool {
9394
"2": "developer",
9495
"3": "business",
9596
}
96-
fmt.Println("To select a plan, choose a correponding number from the following options: ")
97+
fmt.Println("To select a plan, choose a corresponding number from the following options: ")
9798
fmt.Println("1 - Free plan")
9899
fmt.Println("2 - Developer plan")
99100
fmt.Println("3 - Developer Pro plan")
100101
fmt.Printf("Option: ")
101-
fmt.Scanf("%s", &planOption)
102+
fmt.Scanf("%s\n", &planOption)
102103
if planOption == "" {
103104
fmt.Println("Plan is a required entry")
104105
return false
@@ -153,10 +154,16 @@ func add() error {
153154
if err != nil {
154155
return err
155156
}
157+
appInfo, err := api.GetAppsInfo()
158+
if err != nil {
159+
return err
160+
}
161+
appCount := len(appInfo)
156162
newApp := conf.AdminConsoleAPIDomain + "/auth/create-new-app?"
157163
body, _ := json.Marshal(map[string]string{
158164
"appName": AppName,
159165
"domain": Domain,
166+
"ownedAppCount": strconv.Itoa(appCount),
160167
"paymentMethodId": paymentInfo.Data.Order[0].Paymentdetail.Stripepaymentmethodid,
161168
"planName": PlanName,
162169
})

0 commit comments

Comments
 (0)