Skip to content

Commit

Permalink
Fixed the login command with flags input
Browse files Browse the repository at this point in the history
The flags provided with the command were not used by the command previously. Fixed it.
Signed-off-by: muaz-32 <96006730+muaz-32@users.noreply.github.com>
  • Loading branch information
muaz-32 committed May 28, 2024
1 parent 381ec2d commit 275925a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cmd/harbor/root/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ var (

// LoginCommand creates a new `harbor login` command
func LoginCommand() *cobra.Command {
var opts login.LoginView

cmd := &cobra.Command{
Use: "login [server]",
Short: "Log in to Harbor registry",
Expand All @@ -43,7 +41,7 @@ func LoginCommand() *cobra.Command {
var err error

if loginView.Server != "" && loginView.Username != "" && loginView.Password != "" && loginView.Name != "" {
err = runLogin(opts)
err = runLogin(loginView)
} else {
err = createLoginView(&loginView)
}
Expand All @@ -57,7 +55,6 @@ func LoginCommand() *cobra.Command {

flags := cmd.Flags()
flags.StringVarP(&Name, "name", "", "", "name for the set of credentials")

flags.StringVarP(&Username, "username", "u", "", "Username")
flags.StringVarP(&Password, "password", "p", "", "Password")

Expand All @@ -73,11 +70,8 @@ func createLoginView(loginView *login.LoginView) error {
Name: "",
}
}

login.CreateView(loginView)

return runLogin(*loginView)

}

func runLogin(opts login.LoginView) error {
Expand Down

0 comments on commit 275925a

Please sign in to comment.