Documentation
¶
Overview ¶
Package installerx provides utilities for installing various software packages in a streamlined and automated manner. This package is particularly useful for setting up development environments, CI/CD pipelines, and other automated workflows that require the installation of specific software components.
The installerx package includes functions to generate shell commands for downloading and installing software packages, ensuring compatibility with different system architectures and handling any necessary conversions or adjustments.
One of the key features of this package is the ability to generate installation commands for the AWS CLI, a powerful tool for managing AWS services from the command line. The package supports different system architectures, including "x86_64" and "aarch64" (which is converted to "arm64" for compatibility).
Example usage:
package main
import (
"fmt"
"installerx"
)
func main() {
// Generate the installation command for the AWS CLI for the default architecture (x86_64)
command := installerx.GetAwsCliInstallCommand("")
fmt.Println(command)
// Generate the installation command for the AWS CLI for the "aarch64" architecture
command = installerx.GetAwsCliInstallCommand("aarch64")
fmt.Println(command)
}
This package is designed to be easy to use and integrate into existing Go projects, providing a simple and efficient way to automate software installations.
Index ¶
- Constants
- func GetAwsCliInstallCommand(architecture string) string
- func GetGitHubAssetInstallCommand(params GitHubAssetParams) (string, error)
- func GetOpenTofuInstallCommand(params OpenTofuInstallParams) string
- func GetTerraformInstallCommand(params TerraformInstallParams) string
- func GetTerragruntInstallCommand(params TerragruntInstallParams) string
- type GitHubAssetParams
- type OpenTofuInstallParams
- type TerraformInstallParams
- type TerragruntInstallParams
Constants ¶
const (
// DefaultInstallDir is the default directory for installing binaries
DefaultInstallDir = "/usr/local/bin"
)
Variables ¶
This section is empty.
Functions ¶
func GetAwsCliInstallCommand ¶ added in v0.0.30
GetAwsCliInstallCommand generates a shell command to download and install the AWS CLI for the specified architecture. If the architecture is not provided, it defaults to "x86_64". The function also handles the conversion of "aarch64" to "arm64" for compatibility.
Parameters:
architecture - a string representing the system architecture (e.g., "x86_64", "aarch64")
Returns:
A string containing the shell command to install the AWS CLI.
func GetGitHubAssetInstallCommand ¶ added in v0.0.33
func GetGitHubAssetInstallCommand(params GitHubAssetParams) (string, error)
GetGitHubAssetInstallCommand generates a command to download and install a GitHub release asset
Parameters: - params: GitHubAssetParams containing the required information
Returns: - string: The installation command - error: Error if parameters are invalid
func GetOpenTofuInstallCommand ¶ added in v0.0.27
func GetOpenTofuInstallCommand(params OpenTofuInstallParams) string
GetOpenTofuInstallCommand returns a string representing the command to install OpenTofu of a specific version.
Parameters: - params: OpenTofuInstallParams struct containing installation parameters
Returns: - A string representing the installation command
func GetTerraformInstallCommand ¶ added in v0.0.27
func GetTerraformInstallCommand(params TerraformInstallParams) string
GetTerraformInstallCommand returns a string representing the command to install Terraform of a specific version.
Parameters: - params: TerraformInstallParams struct containing installation parameters
Returns: - A string representing the installation command
func GetTerragruntInstallCommand ¶ added in v0.0.27
func GetTerragruntInstallCommand(params TerragruntInstallParams) string
GetTerragruntInstallCommand returns a string representing the command to install Terragrunt of a specific version.
Parameters: - params: TerragruntInstallParams struct containing installation parameters
Returns: - A string representing the installation command
Types ¶
type GitHubAssetParams ¶ added in v0.0.33
type GitHubAssetParams struct {
// Organization or user who owns the repository
Owner string
// Repository name
Repo string
// Version of the release (with or without 'v' prefix)
Version string
// Asset name pattern (e.g., "terraform-docs-v{version}-{os}-{arch}.tar.gz")
// If empty, AssetName will be used directly
AssetPattern string
// AssetName is the direct name of the asset if pattern is not used
AssetName string
// InstallDir is the directory where the binary will be installed
InstallDir string
// BinaryName is the name of the binary to be installed after extraction
BinaryName string
// OS target operating system (defaults to "linux")
OS string
// Arch target architecture (defaults to "amd64")
Arch string
// ExtractPath specifies the path to the binary within the archive
// If empty, BinaryName will be used
ExtractPath string
}
GitHubAssetParams represents parameters for downloading a GitHub release asset
type OpenTofuInstallParams ¶ added in v0.0.28
type OpenTofuInstallParams struct {
// Version of OpenTofu to install (e.g., "1.6.0")
Version string
// InstallDir is the directory to install OpenTofu. If empty, defaults to DefaultInstallDir
InstallDir string
}
OpenTofuInstallParams represents the parameters for installing OpenTofu
type TerraformInstallParams ¶ added in v0.0.28
type TerraformInstallParams struct {
// Version of Terraform to install (e.g., "1.0.0")
Version string
// InstallDir is the directory to install Terraform. If empty, defaults to DefaultInstallDir
InstallDir string
}
TerraformInstallParams represents the parameters for installing Terraform
type TerragruntInstallParams ¶ added in v0.0.28
type TerragruntInstallParams struct {
// Version of Terragrunt to install (e.g., "0.38.0")
Version string
// InstallDir is the directory to install Terragrunt. If empty, defaults to "/usr/local/bin"
InstallDir string
}
TerragruntInstallParams represents the parameters for installing Terragrunt