github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/src/cmd/tools/helm/repo.go (about)

     1  /*
     2  Copyright The Helm Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  /*
    18  NOTICE: This file's 'package' and some functionality has been modified / removed to fit within Jackal's package structure.
    19  */
    20  
    21  // Package helm is a copy of the main package from helm to include a subset of the helm CLI in Jackal
    22  package helm
    23  
    24  import (
    25  	"io"
    26  	"os"
    27  
    28  	"github.com/pkg/errors"
    29  	"github.com/spf13/cobra"
    30  
    31  	"helm.sh/helm/v3/cmd/helm/require"
    32  	"helm.sh/helm/v3/pkg/cli"
    33  )
    34  
    35  var settings = cli.New()
    36  
    37  var repoHelm = `
    38  This command consists of multiple subcommands to interact with chart repositories.
    39  
    40  It can be used to add, remove, list, and index chart repositories.
    41  `
    42  
    43  func newRepoCmd(out io.Writer) *cobra.Command {
    44  	cmd := &cobra.Command{
    45  		Use:   "repo add|remove|list|index|update [ARGS]",
    46  		Short: "add, list, remove, update, and index chart repositories",
    47  		Long:  repoHelm,
    48  		Args:  require.NoArgs,
    49  	}
    50  
    51  	cmd.AddCommand(newRepoAddCmd(out))
    52  	cmd.AddCommand(newRepoListCmd(out))
    53  	cmd.AddCommand(newRepoRemoveCmd(out))
    54  	cmd.AddCommand(newRepoIndexCmd(out))
    55  	cmd.AddCommand(newRepoUpdateCmd(out))
    56  
    57  	return cmd
    58  }
    59  
    60  func isNotExist(err error) bool {
    61  	return os.IsNotExist(errors.Cause(err))
    62  }