Skip to content

Commit

Permalink
Merge pull request #1363 from k4leung4/keygen
Browse files Browse the repository at this point in the history
expose keygen options
  • Loading branch information
k4leung4 committed Jul 10, 2024
2 parents b010645 + fc0e8e7 commit f8a5fa9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cli/keygen.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ type KeygenContext struct {

type KeygenOption func(*KeygenContext) error

func withKeyName(keyName string) KeygenOption {
func WithKeyName(keyName string) KeygenOption {
return func(kc *KeygenContext) error {
kc.KeyName = keyName
return nil
}
}

func withBitSize(bitSize int) KeygenOption {
func WithBitSize(bitSize int) KeygenOption {
return func(kc *KeygenContext) error {
kc.BitSize = bitSize
return nil
Expand Down Expand Up @@ -84,11 +84,11 @@ func Keygen() *cobra.Command {
Args: cobra.MinimumNArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
options := []KeygenOption{
withBitSize(keySize),
WithBitSize(keySize),
}

if len(args) > 0 {
options = append(options, withKeyName(args[0]))
options = append(options, WithKeyName(args[0]))
}

return KeygenCmd(cmd.Context(), options...)
Expand Down

0 comments on commit f8a5fa9

Please sign in to comment.