@@ -98,8 +98,8 @@ func NewRootCmd() *cobra.Command {
9898 return errors .New ("cannot use --version together with chart directory" )
9999 }
100100
101- if strings .HasPrefix (s .ChartName , "http://" ) || strings .HasPrefix (s .ChartName , "https://" ) || strings . HasPrefix ( s . ChartName , "oci://" ) {
102- return errors .New ("cannot use --version together with chart URL" )
101+ if strings .HasPrefix (s .ChartName , "http://" ) || strings .HasPrefix (s .ChartName , "https://" ) {
102+ return errors .New ("cannot use --version together with chart HTTP(S) URL" )
103103 }
104104 }
105105
@@ -111,18 +111,22 @@ func NewRootCmd() *cobra.Command {
111111 return errors .New ("cannot use both --target and --exclude together" )
112112 }
113113
114- // If chart is specified through an url, the fetch it from the url .
114+ // If chart is specified through an URL, then fetch it from the URL .
115115 if strings .HasPrefix (s .ChartName , "http://" ) || strings .HasPrefix (s .ChartName , "https://" ) || strings .HasPrefix (s .ChartName , "oci://" ) {
116- log .Info (1 , "fetching chart from url \" %s\" ..." , s .ChartName )
116+ if s .ChartVersion != "" {
117+ log .Info (1 , "fetching chart from URL \" %s\" with version \" %s\" ..." , s .ChartName , s .ChartVersion )
118+ } else {
119+ log .Info (1 , "fetching chart from URL \" %s\" ..." , s .ChartName )
120+ }
117121 var err error
118- s .ChartName , err = helm .Fetch (s .ChartName , "" )
122+ s .ChartName , err = helm .Fetch (s .ChartName , s . ChartVersion )
119123 if err != nil {
120- return fmt .Errorf ("fetching chart %s: %w" , s .ChartName , err )
124+ return fmt .Errorf ("fetching chart %s with version %s : %w" , s .ChartName , s . ChartVersion , err )
121125 }
122126 } else if _ , err := os .Stat (s .ChartName ); err != nil {
123127 // If local file (or directory) does not exist, then fetch it from a repo.
124128 if s .ChartVersion != "" {
125- log .Info (1 , "fetching chart \" %s\" version \" %s\" from repos ..." , s .ChartName , s .ChartVersion )
129+ log .Info (1 , "fetching chart \" %s\" from repos with version \" %s\" ..." , s .ChartName , s .ChartVersion )
126130 } else {
127131 log .Info (1 , "fetching chart \" %s\" from repos..." , s .ChartName )
128132 }
0 commit comments