Skip to content

Commit

Permalink
Fix positional args usage in kick (carvel-dev#1556)
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen Rewar <[email protected]>
  • Loading branch information
praveenrewar authored May 2, 2024
1 parent 29813b7 commit 290305f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cli/pkg/kctrl/cmd/package/repository/kick.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewKickCmd(o *KickOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Comman
cmd := &cobra.Command{
Use: "kick",
Short: "Trigger reconciliation for repository",
RunE: func(_ *cobra.Command, _ []string) error { return o.Run() },
RunE: func(_ *cobra.Command, args []string) error { return o.Run(args) },
Example: cmdcore.Examples{
cmdcore.Example{"Trigger reconciliation for repository",
[]string{"package", "repository", "kick", "-r", "sample-repo"}},
Expand Down Expand Up @@ -70,7 +70,13 @@ func NewKickCmd(o *KickOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Comman
return cmd
}

func (o *KickOptions) Run() error {
func (o *KickOptions) Run(args []string) error {
if o.pkgCmdTreeOpts.PositionalArgs {
if len(args) > 0 {
o.Name = args[0]
}
}

if len(o.Name) == 0 {
return fmt.Errorf("Expected repository name to be non empty")
}
Expand Down

0 comments on commit 290305f

Please sign in to comment.