...

Source file src/helm.sh/helm/v3/pkg/plugin/installer/base.go

Documentation: helm.sh/helm/v3/pkg/plugin/installer

     1  /*
     2  Copyright The Helm Authors.
     3  Licensed under the Apache License, Version 2.0 (the "License");
     4  you may not use this file except in compliance with the License.
     5  You may obtain a copy of the License at
     6  
     7  http://www.apache.org/licenses/LICENSE-2.0
     8  
     9  Unless required by applicable law or agreed to in writing, software
    10  distributed under the License is distributed on an "AS IS" BASIS,
    11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  See the License for the specific language governing permissions and
    13  limitations under the License.
    14  */
    15  
    16  package installer // import "helm.sh/helm/v3/pkg/plugin/installer"
    17  
    18  import (
    19  	"path/filepath"
    20  
    21  	"helm.sh/helm/v3/pkg/cli"
    22  )
    23  
    24  type base struct {
    25  	// Source is the reference to a plugin
    26  	Source string
    27  	// PluginsDirectory is the directory where plugins are installed
    28  	PluginsDirectory string
    29  }
    30  
    31  func newBase(source string) base {
    32  	settings := cli.New()
    33  	return base{
    34  		Source:           source,
    35  		PluginsDirectory: settings.PluginsDirectory,
    36  	}
    37  }
    38  
    39  // Path is where the plugin will be installed.
    40  func (b *base) Path() string {
    41  	if b.Source == "" {
    42  		return ""
    43  	}
    44  	return filepath.Join(b.PluginsDirectory, filepath.Base(b.Source))
    45  }
    46  

View as plain text