newDependencyUpdateCmd creates a new dependency update command.
(_ *action.Configuration, out io.Writer)
| 45 | |
| 46 | // newDependencyUpdateCmd creates a new dependency update command. |
| 47 | func newDependencyUpdateCmd(_ *action.Configuration, out io.Writer) *cobra.Command { |
| 48 | client := action.NewDependency() |
| 49 | |
| 50 | cmd := &cobra.Command{ |
| 51 | Use: "update CHART", |
| 52 | Aliases: []string{"up"}, |
| 53 | Short: "update charts/ based on the contents of Chart.yaml", |
| 54 | Long: dependencyUpDesc, |
| 55 | Args: require.MaximumNArgs(1), |
| 56 | RunE: func(_ *cobra.Command, args []string) error { |
| 57 | chartpath := "." |
| 58 | if len(args) > 0 { |
| 59 | chartpath = filepath.Clean(args[0]) |
| 60 | } |
| 61 | registryClient, err := newRegistryClient(out, client.CertFile, client.KeyFile, client.CaFile, |
| 62 | client.InsecureSkipTLSVerify, client.PlainHTTP, client.Username, client.Password) |
| 63 | if err != nil { |
| 64 | return fmt.Errorf("missing registry client: %w", err) |
| 65 | } |
| 66 | |
| 67 | man := &downloader.Manager{ |
| 68 | Out: out, |
| 69 | ChartPath: chartpath, |
| 70 | Keyring: client.Keyring, |
| 71 | SkipUpdate: client.SkipRefresh, |
| 72 | Getters: getter.All(settings), |
| 73 | RegistryClient: registryClient, |
| 74 | RepositoryConfig: settings.RepositoryConfig, |
| 75 | RepositoryCache: settings.RepositoryCache, |
| 76 | ContentCache: settings.ContentCache, |
| 77 | Debug: settings.Debug, |
| 78 | } |
| 79 | if client.Verify { |
| 80 | man.Verify = downloader.VerifyAlways |
| 81 | } |
| 82 | return man.Update() |
| 83 | }, |
| 84 | } |
| 85 | |
| 86 | f := cmd.Flags() |
| 87 | addDependencySubcommandFlags(f, client) |
| 88 | |
| 89 | return cmd |
| 90 | } |
no test coverage detected
searching dependent graphs…