Skip to content

Commit b879bed

Browse files
authored
Merge pull request #226 from liangyuanpeng/login_stdin
feat: support login with password from stdin
2 parents d6c852f + 7f18d9e commit b879bed

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cmd/kcl/commands/registry.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ const (
1717
)
1818

1919
var (
20-
username string
21-
password string
20+
username string
21+
password string
22+
passwordFromStdin bool
2223
)
2324

2425
// NewModCmd returns the mod command.

cmd/kcl/commands/registry_login.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewRegistryLoginCmd(cli *client.KpmClient) *cobra.Command {
3131
RunE: func(_ *cobra.Command, args []string) error {
3232
registry := args[0]
3333

34-
username, password, err := utils.GetUsernamePassword(username, password, false)
34+
username, password, err := utils.GetUsernamePassword(username, password, passwordFromStdin)
3535
if err != nil {
3636
return err
3737
}
@@ -50,6 +50,7 @@ func NewRegistryLoginCmd(cli *client.KpmClient) *cobra.Command {
5050

5151
cmd.Flags().StringVarP(&username, "username", "u", "", "registry username")
5252
cmd.Flags().StringVarP(&password, "password", "p", "", "registry password or identity token")
53+
cmd.Flags().BoolVar(&passwordFromStdin, "password-stdin", false, "password from stdin")
5354
cmd.Flags().BoolVar(&insecureSkipTLSverify, "insecure-skip-tls-verify", false, "skip tls verification")
5455
return cmd
5556
}

0 commit comments

Comments
 (0)