Skip to content

Commit

Permalink
Login command - Ensure JFrog Platform URL input is non-empty before p…
Browse files Browse the repository at this point in the history
…roceeding (#1308)

* Improve upload archive progress bar

Signed-off-by: Michael Sverdlov <[email protected]>

* Improve upload archive progress bar

Signed-off-by: Michael Sverdlov <[email protected]>

* Improve upload archive progress bar

Signed-off-by: Michael Sverdlov <[email protected]>

---------

Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 authored Dec 13, 2024
1 parent 0548b79 commit 8e11807
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
20 changes: 11 additions & 9 deletions general/login/login.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package login

import (
"fmt"
"github.com/jfrog/jfrog-cli-core/v2/common/commands"
"github.com/jfrog/jfrog-cli-core/v2/general"
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
Expand Down Expand Up @@ -32,21 +33,22 @@ func (lc *LoginCommand) Run() error {
}

func newConfLogin() error {
platformUrl, err := promptPlatformUrl()
if err != nil {
return err
}
platformUrl := promptPlatformUrl()
newServer := config.ServerDetails{Url: platformUrl}
return general.ConfigServerWithDeducedId(&newServer, true, true)
}

func promptPlatformUrl() (string, error) {
func promptPlatformUrl() string {
var platformUrl string
ioutils.ScanFromConsole("Enter your JFrog Platform URL", &platformUrl, "")
if platformUrl == "" {
return "", errorutils.CheckErrorf("providing JFrog Platform URL is mandatory")
// Loop until a non-empty platformUrl is entered
for {
ioutils.ScanFromConsole("Enter your JFrog Platform URL", &platformUrl, "")
if platformUrl != "" {
break
}
fmt.Println("The JFrog Platform URL cannot be empty. Please try again.")
}
return platformUrl, nil
return platformUrl
}

func existingConfLogin(configurations []*config.ServerDetails) error {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ require (
github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1
github.com/google/uuid v1.6.0
github.com/gookit/color v1.5.4
github.com/jedib0t/go-pretty/v6 v6.6.1
github.com/jedib0t/go-pretty/v6 v6.6.3
github.com/jfrog/build-info-go v1.10.6
github.com/jfrog/gofrog v1.7.6
github.com/jfrog/jfrog-client-go v1.48.3
github.com/magiconair/properties v1.8.7
github.com/manifoldco/promptui v0.9.0
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
github.com/urfave/cli v1.22.16
github.com/vbauerster/mpb/v8 v8.8.3
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jedib0t/go-pretty/v6 v6.6.1 h1:iJ65Xjb680rHcikRj6DSIbzCex2huitmc7bDtxYVWyc=
github.com/jedib0t/go-pretty/v6 v6.6.1/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jedib0t/go-pretty/v6 v6.6.3 h1:nGqgS0tgIO1Hto47HSaaK4ac/I/Bu7usmdD3qvs0WvM=
github.com/jedib0t/go-pretty/v6 v6.6.3/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI=
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
github.com/jfrog/build-info-go v1.10.6 h1:zH1ZhXlVfi5DlFyunygHjrdOcnv5qxfeLqmsfD4+lc4=
Expand Down Expand Up @@ -191,8 +191,9 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/terminalstatic/go-xsd-validate v0.1.5 h1:RqpJnf6HGE2CB/lZB1A8BYguk8uRtcvYAPLCF15qguo=
Expand Down

0 comments on commit 8e11807

Please sign in to comment.