Merge pull request #30842 from ayushontop/main

Fix : No repository is not an error,use the helm repo list command ,if there is no repository,it should not be an error #30606
pull/30862/head
Matt Farina 4 months ago committed by GitHub
commit dd40316660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -17,7 +17,6 @@ limitations under the License.
package cmd
import (
"errors"
"fmt"
"io"
@ -37,10 +36,11 @@ func newRepoListCmd(out io.Writer) *cobra.Command {
Short: "list chart repositories",
Args: require.NoArgs,
ValidArgsFunction: noMoreArgsCompFunc,
RunE: func(_ *cobra.Command, _ []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
f, _ := repo.LoadFile(settings.RepositoryConfig)
if len(f.Repositories) == 0 && outfmt != output.JSON && outfmt != output.YAML {
return errors.New("no repositories to show")
fmt.Fprintln(cmd.ErrOrStderr(), "no repositories to show")
return nil
}
return outfmt.Write(out, &repoListWriter{f.Repositories})

Loading…
Cancel
Save