|
|
@ -20,6 +20,7 @@ import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/gosuri/uitable"
|
|
|
|
"github.com/gosuri/uitable"
|
|
|
@ -129,7 +130,7 @@ func index(dir, url string) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func addRepository(name, url string) error {
|
|
|
|
func addRepository(name, url string) error {
|
|
|
|
if err := repo.DownloadIndexFile(name, url, cacheDirectory(name+"-index.yaml")); err != nil {
|
|
|
|
if err := repo.DownloadIndexFile(name, url, cacheIndexFile(name)); err != nil {
|
|
|
|
return errors.New("Looks like " + url + " is not a valid chart repository or cannot be reached: " + err.Error())
|
|
|
|
return errors.New("Looks like " + url + " is not a valid chart repository or cannot be reached: " + err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -152,6 +153,9 @@ func removeRepoLine(name string) error {
|
|
|
|
if err := ioutil.WriteFile(repositoriesFile(), b, 0666); err != nil {
|
|
|
|
if err := ioutil.WriteFile(repositoriesFile(), b, 0666); err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := removeRepoCache(name); err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return fmt.Errorf("The repository, %s, does not exist in your repositories list", name)
|
|
|
|
return fmt.Errorf("The repository, %s, does not exist in your repositories list", name)
|
|
|
@ -160,6 +164,16 @@ func removeRepoLine(name string) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func removeRepoCache(name string) error {
|
|
|
|
|
|
|
|
if _, err := os.Stat(cacheIndexFile(name)); err == nil {
|
|
|
|
|
|
|
|
err = os.Remove(cacheIndexFile(name))
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func insertRepoLine(name, url string) error {
|
|
|
|
func insertRepoLine(name, url string) error {
|
|
|
|
f, err := repo.LoadRepositoriesFile(repositoriesFile())
|
|
|
|
f, err := repo.LoadRepositoriesFile(repositoriesFile())
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|