|
|
@ -55,15 +55,10 @@ func runRepoAdd(cmd *cobra.Command, args []string) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
name, url := args[0], args[1]
|
|
|
|
name, url := args[0], args[1]
|
|
|
|
|
|
|
|
|
|
|
|
if err := repo.DownloadIndexFile(name, url, cacheDirectory(name, "-index.yaml")); err != nil {
|
|
|
|
if err := addRepository(name, url); err != nil {
|
|
|
|
return errors.New("Oops! Looks like " + url + " is not a valid chart repository or cannot be reached\n")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := insertRepoLine(name, url); err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(name + " has been added to your repositories")
|
|
|
|
fmt.Println(args[0] + " has been added to your repositories")
|
|
|
|
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -114,6 +109,14 @@ func index(dir, url string) error {
|
|
|
|
return chartRepo.Index()
|
|
|
|
return chartRepo.Index()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func addRepository(name, url string) error {
|
|
|
|
|
|
|
|
if err := repo.DownloadIndexFile(name, url, cacheDirectory(name, "-index.yaml")); err != nil {
|
|
|
|
|
|
|
|
return errors.New("Looks like " + url + " is not a valid chart repository or cannot be reached\n")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return insertRepoLine(name, url)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func removeRepoLine(name string) error {
|
|
|
|
func removeRepoLine(name string) error {
|
|
|
|
r, err := repo.LoadRepositoriesFile(repositoriesFile())
|
|
|
|
r, err := repo.LoadRepositoriesFile(repositoriesFile())
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|