Documentation
¶
Index ¶
- Constants
- Variables
- func LastUsedVersion() (string, error)
- func LatestLoftBinary(ctx context.Context) (string, string, error)
- func LoftAbsoluteWorkingDirectory(version string) (string, error)
- func LoftBinary(ctx context.Context, version string) (string, error)
- func LoftBinaryFilePath(version string) (string, error)
- func LoftConfigFilePath(version string) (string, error)
- func LoftWorkingDirectory(version string) string
- func RunLoftCli(ctx context.Context, version string, args []string) error
- func WriteConfig(c *CLIConfig) error
- type CLIConfig
Constants ¶
const (
VclusterProFolder = "pro"
BinariesFolder = "bin"
)
Variables ¶
var (
LoftBinaryName = "loft"
LoftConfigName = "config.json"
)
var (
// ErrNoLastVersion is returned if no last version was found in the config
ErrNoLastVersion = errors.New("no vcluster pro version found, please run 'vcluster pro login' first")
)
Functions ¶
func LastUsedVersion ¶
func LastUsedVersion() (string, error)
LastUsedVersion returns the last used version of the loft cli
func LatestLoftBinary ¶
func LatestLoftBinary(ctx context.Context) (string, string, error)
LatestLoftBinary returns the path to the latest loft binary if it exists
Returns the path to the loft binary and the version tag
func LoftAbsoluteWorkingDirectory ¶
func LoftAbsoluteWorkingDirectory(version string) (string, error)
LoftAbsoluteWorkingDirectory returns the absolute path to the loft working directory for the given version
func LoftBinary ¶
func LoftBinary(ctx context.Context, version string) (string, error)
LoftBinary returns the path to the loft binary for the given version
Returns the path to the loft binary and the version tag
func LoftBinaryFilePath ¶
func LoftBinaryFilePath(version string) (string, error)
LoftBinaryFilePath returns the path to the loft binary for the given version
func LoftConfigFilePath ¶
func LoftConfigFilePath(version string) (string, error)
LoftConfigFilePath returns the path to the loft config file for the given version
func LoftWorkingDirectory ¶
func LoftWorkingDirectory(version string) string
LoftWorkingDirectory returns the path to the loft working directory for the given version
func RunLoftCli ¶
func RunLoftCli(ctx context.Context, version string, args []string) error
RunLoftCli executes a loft CLI command for the given version with the provided arguments.
It determines the loft binary path and sets the working directory, config file, and env vars needed to run the command.
The CLI arguments are appended to "pro" as the first arg. The command is executed and any error returned.
func WriteConfig ¶
func WriteConfig(c *CLIConfig) error
WriteConfig writes the given config to the config file