Documentation ¶
Index ¶
- func CatchAndExit(err error)
- func Contains(slice []string, target string) (int, bool)
- func DeleteAssetAndBinary(stewPkgPath, stewBinPath, asset, binary string) error
- func DetectAsset(userOS string, userArch string, releaseAssets []string) (string, error)
- func DownloadFile(downloadPath string, url string) error
- func FormatSearchResults(ghSearch GithubSearch) []string
- func GetDefaultStewBinPath(userOS string) (string, error)
- func GetDefaultStewPath(userOS string) (string, error)
- func GetGithubReleasesAssets(ghProject GithubProject, tag string) ([]string, error)
- func GetGithubReleasesTags(ghProject GithubProject) ([]string, error)
- func GetStewConfigFilePath(userOS string) (string, error)
- func Initialize() (string, string, StewConfig, SystemInfo, error)
- func InstallBinary(downloadedFilePath string, repo string, systemInfo SystemInfo, ...) (string, error)
- func PathExists(path string) (bool, error)
- func PromptConfig(suggestedStewPath, suggestedStewBinPath string) (string, string, error)
- func PromptInput(message string, defaultInput string) (string, error)
- func PromptRenameBinary(originalBinaryName string) (string, error)
- func PromptSelect(message string, options []string) (string, error)
- func ReadStewfileContents(stewfilePath string) ([]string, error)
- func ResolvePath(filePath string) (string, error)
- func ValidateCLIInput(cliInput string) error
- func ValidateGithubSearchQuery(searchQuery string) error
- func ValidateStewBinPath(stewBinPath, pathVariable string) bool
- func WarningPromptConfirm(message string) (bool, error)
- func WarningPromptSelect(message string, options []string) (string, error)
- func WriteLockFileJSON(lockFileJSON LockFile, outputPath string) error
- func WriteStewConfigJSON(stewConfigFileJSON StewConfig, outputPath string) error
- type AbortBinaryOverwriteError
- type AlreadyInstalledLatestTagError
- type AssetAlreadyDownloadedError
- type AssetsNotFoundError
- type BinaryNotInstalledError
- type CLIFlagAndInputError
- type CLIInput
- type EmptyCLIInputError
- type ExitUserSelectionError
- type GithubAPIResponse
- type GithubAsset
- type GithubProject
- type GithubRelease
- type GithubSearch
- type GithubSearchResult
- type IndexOutOfBoundsInLockfileError
- type InstalledFromURLError
- type InvalidGithubSearchQueryError
- type LockFile
- type NoBinariesInstalledError
- type NoGithubSearchResultsError
- type NoPackagesInLockfileError
- type NonZeroStatusCodeDownloadError
- type NonZeroStatusCodeError
- type PackageData
- type ReleasesNotFoundError
- type StewConfig
- type StewpathNotFoundError
- type SystemInfo
- type UnrecognizedInputError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CatchAndExit ¶
func CatchAndExit(err error)
CatchAndExit will catch errors and immediately exit
func DeleteAssetAndBinary ¶
DeleteAssetAndBinary will delete the asset from the ~/.stew/pkg path and delete the binary from the ~/.stew/bin path
func DetectAsset ¶
DetectAsset will automatically detect a release asset matching your systems OS/arch or prompt you to manually select an asset
func DownloadFile ¶
DownloadFile will download a file from url to a given path
func FormatSearchResults ¶ added in v0.2.0
func FormatSearchResults(ghSearch GithubSearch) []string
FormatSearchResults formats the GitHub search results for the terminal UI
func GetDefaultStewBinPath ¶ added in v0.3.0
GetDefaultStewBinPath will return the default path where binaries are installed by stew
func GetDefaultStewPath ¶ added in v0.3.0
GetDefaultStewPath will return the default path to the top-level stew directory
func GetGithubReleasesAssets ¶
func GetGithubReleasesAssets(ghProject GithubProject, tag string) ([]string, error)
GetGithubReleasesAssets gets a string slice of the assets for a GithubRelease
func GetGithubReleasesTags ¶
func GetGithubReleasesTags(ghProject GithubProject) ([]string, error)
GetGithubReleasesTags gets a string slice of the releases for a GithubProject
func GetStewConfigFilePath ¶ added in v0.3.0
GetStewConfigFilePath will return the stew config file path
func Initialize ¶ added in v0.3.0
func Initialize() (string, string, StewConfig, SystemInfo, error)
Initialize returns pertinent initialization information like OS, arch, configuration, and system info
func InstallBinary ¶
func InstallBinary(downloadedFilePath string, repo string, systemInfo SystemInfo, lockFile *LockFile, overwriteFromUpgrade bool) (string, error)
InstallBinary will extract the binary and copy it to the ~/.stew/bin path
func PathExists ¶
PathExists checks if a given path exists
func PromptConfig ¶ added in v0.3.0
PromptConfig launches an interactive UI for setting the stew config values. It returns the resolved stewPath and stewBinPath.
func PromptInput ¶ added in v0.3.0
PromptInput launches the input UI
func PromptRenameBinary ¶ added in v0.3.0
PromptRenameBinary takes in the original name of the binary and will return the new name of the binary.
func PromptSelect ¶
PromptSelect launches the selection UI
func ReadStewfileContents ¶
ReadStewfileContents will read the contents of the Stewfile
func ResolvePath ¶ added in v0.3.0
ResolvePath will resolve the full path for an input path
func ValidateCLIInput ¶
ValidateCLIInput makes sure the CLI input isn't empty
func ValidateGithubSearchQuery ¶ added in v0.2.0
ValidateGithubSearchQuery makes sure the GitHub search query is valid
func ValidateStewBinPath ¶ added in v0.3.0
func WarningPromptConfirm ¶
WarningPromptConfirm launches the confirm UI with a warning styling
func WarningPromptSelect ¶
WarningPromptSelect launches the selection UI with a warning styling
func WriteLockFileJSON ¶
WriteLockFileJSON will write the lockfile JSON file
func WriteStewConfigJSON ¶ added in v0.3.0
func WriteStewConfigJSON(stewConfigFileJSON StewConfig, outputPath string) error
WriteStewConfigJSON will write the config JSON file
Types ¶
type AbortBinaryOverwriteError ¶
type AbortBinaryOverwriteError struct {
Binary string
}
AbortBinaryOverwriteError occurs if the overwrite of a binary is aborted
func (AbortBinaryOverwriteError) Error ¶
func (e AbortBinaryOverwriteError) Error() string
type AlreadyInstalledLatestTagError ¶
type AlreadyInstalledLatestTagError struct {
Tag string
}
AlreadyInstalledLatestTagError occurs if you try to upgrade a binary but the latest version is already installed
func (AlreadyInstalledLatestTagError) Error ¶
func (e AlreadyInstalledLatestTagError) Error() string
type AssetAlreadyDownloadedError ¶
type AssetAlreadyDownloadedError struct {
Asset string
}
AssetAlreadyDownloadedError occurs if the requested asset has already been downloaded
func (AssetAlreadyDownloadedError) Error ¶
func (e AssetAlreadyDownloadedError) Error() string
type AssetsNotFoundError ¶
type AssetsNotFoundError struct {
Tag string
}
AssetsNotFoundError occurs if no assets are found for a GitHub release
func (AssetsNotFoundError) Error ¶
func (e AssetsNotFoundError) Error() string
type BinaryNotInstalledError ¶
type BinaryNotInstalledError struct {
Binary string
}
BinaryNotInstalledError occurs if you try to operate on a binary that is not installed
func (BinaryNotInstalledError) Error ¶
func (e BinaryNotInstalledError) Error() string
type CLIFlagAndInputError ¶ added in v0.2.0
type CLIFlagAndInputError struct { }
CLIFlagAndInputError occurs if you try to use a CLI flag with a CLI input at the same time
func (CLIFlagAndInputError) Error ¶ added in v0.2.0
func (e CLIFlagAndInputError) Error() string
type CLIInput ¶
type CLIInput struct { IsGithubInput bool Owner string Repo string Tag string Asset string DownloadURL string }
CLIInput contains information about the parsed CLI input
func ParseCLIInput ¶
ParseCLIInput creates a new instance of the CLIInput struct
type EmptyCLIInputError ¶
type EmptyCLIInputError struct { }
EmptyCLIInputError occurs if the CLI input is empty
func (EmptyCLIInputError) Error ¶
func (e EmptyCLIInputError) Error() string
type ExitUserSelectionError ¶
type ExitUserSelectionError struct {
Err error
}
ExitUserSelectionError occurs when exiting from the terminal UI
func (ExitUserSelectionError) Error ¶
func (e ExitUserSelectionError) Error() string
type GithubAPIResponse ¶
type GithubAPIResponse []GithubRelease
GithubAPIResponse is the response from the GitHub releases API
type GithubAsset ¶
type GithubAsset struct { Name string `json:"name"` DownloadURL string `json:"browser_download_url"` Size int `json:"size"` ContentType string `json:"content_type"` }
GithubAsset contains information about a specific GitHub asset
type GithubProject ¶
type GithubProject struct { Owner string Repo string Releases GithubAPIResponse }
GithubProject contains information about the GitHub project including GitHub releases
func NewGithubProject ¶
func NewGithubProject(owner, repo string) (GithubProject, error)
NewGithubProject creates a new instance of the GithubProject struct
type GithubRelease ¶
type GithubRelease struct { TagName string `json:"tag_name"` Assets []GithubAsset `json:"assets"` }
GithubRelease contains information about a GitHub release, including the associated assets
type GithubSearch ¶ added in v0.2.0
type GithubSearch struct { SearchQuery string Count int `json:"total_count"` Items []GithubSearchResult `json:"items"` }
GithubSearch contains information about the GitHub search including the GitHub search results
func NewGithubSearch ¶ added in v0.2.0
func NewGithubSearch(searchQuery string) (GithubSearch, error)
NewGithubSearch creates a new instance of the GithubSearch struct
type GithubSearchResult ¶ added in v0.2.0
type GithubSearchResult struct { FullName string `json:"full_name"` Stars int `json:"stargazers_count"` Language string `json:"language"` Description string `json:"description"` }
GithubSearchResult contains information about the GitHub search result
type IndexOutOfBoundsInLockfileError ¶
type IndexOutOfBoundsInLockfileError struct { }
IndexOutOfBoundsInLockfileError occurs if you try to access an out-of-bounds index in the lockfile packages
func (IndexOutOfBoundsInLockfileError) Error ¶
func (e IndexOutOfBoundsInLockfileError) Error() string
type InstalledFromURLError ¶
type InstalledFromURLError struct {
Binary string
}
InstalledFromURLError occurs if you try to perform GitHub specific actions on a binary installed directly from a URL
func (InstalledFromURLError) Error ¶
func (e InstalledFromURLError) Error() string
type InvalidGithubSearchQueryError ¶ added in v0.2.0
type InvalidGithubSearchQueryError struct {
SearchQuery string
}
InvalidGithubSearchQueryError occurs if the GitHub search query contains invalid characters
func (InvalidGithubSearchQueryError) Error ¶ added in v0.2.0
func (e InvalidGithubSearchQueryError) Error() string
type LockFile ¶
type LockFile struct { Os string `json:"os"` Arch string `json:"arch"` Packages []PackageData `json:"packages"` }
LockFile contains all the data for the lockfile
func NewLockFile ¶
NewLockFile creates a new instance of the LockFile struct
type NoBinariesInstalledError ¶
type NoBinariesInstalledError struct { }
NoBinariesInstalledError occurs if you try to operate on a binary but no binaries are installed
func (NoBinariesInstalledError) Error ¶
func (e NoBinariesInstalledError) Error() string
type NoGithubSearchResultsError ¶ added in v0.2.0
type NoGithubSearchResultsError struct {
SearchQuery string
}
NoGithubSearchResultsError occurs if the GitHub search API returns no items
func (NoGithubSearchResultsError) Error ¶ added in v0.2.0
func (e NoGithubSearchResultsError) Error() string
type NoPackagesInLockfileError ¶
type NoPackagesInLockfileError struct { }
NoPackagesInLockfileError occurs if you try to remove packages from a lockfile without any packages
func (NoPackagesInLockfileError) Error ¶
func (e NoPackagesInLockfileError) Error() string
type NonZeroStatusCodeDownloadError ¶
type NonZeroStatusCodeDownloadError struct {
StatusCode int
}
NonZeroStatusCodeDownloadError occurs if a non-zero status code is received when trying to download a file
func (NonZeroStatusCodeDownloadError) Error ¶
func (e NonZeroStatusCodeDownloadError) Error() string
type NonZeroStatusCodeError ¶
type NonZeroStatusCodeError struct {
StatusCode int
}
NonZeroStatusCodeError occurs if a non-zero status code is received from an HTTP request
func (NonZeroStatusCodeError) Error ¶
func (e NonZeroStatusCodeError) Error() string
type PackageData ¶
type PackageData struct { Source string `json:"source"` Owner string `json:"owner"` Repo string `json:"repo"` Tag string `json:"tag"` Asset string `json:"asset"` Binary string `json:"binary"` URL string `json:"url"` }
PackageData contains the information for an installed binary
func RemovePackage ¶
func RemovePackage(pkgs []PackageData, index int) ([]PackageData, error)
RemovePackage will remove a package from a LockFile.Packages slice
type ReleasesNotFoundError ¶
ReleasesNotFoundError occurs if no releases are found for a GitHub repo
func (ReleasesNotFoundError) Error ¶
func (e ReleasesNotFoundError) Error() string
type StewConfig ¶ added in v0.3.0
type StewConfig struct { StewPath string `json:"stewPath"` StewBinPath string `json:"stewBinPath"` }
StewConfig contains all the stew configuration data
func NewStewConfig ¶ added in v0.3.0
func NewStewConfig(userOS string) (StewConfig, error)
NewStewConfig creates a new instance of the StewConfig struct
type StewpathNotFoundError ¶ added in v0.2.0
type StewpathNotFoundError struct {
StewPath string
}
StewpathNotFoundError occurs if the ~/.stew path is not found
func (StewpathNotFoundError) Error ¶ added in v0.2.0
func (e StewpathNotFoundError) Error() string
type SystemInfo ¶
type SystemInfo struct { StewPath string StewBinPath string StewPkgPath string StewLockFilePath string StewTmpPath string }
SystemInfo contains system specific info like OS, arch, and ~/.stew paths
func NewSystemInfo ¶
func NewSystemInfo(stewConfig StewConfig) SystemInfo
NewSystemInfo creates a new instance of the SystemInfo struct
type UnrecognizedInputError ¶
type UnrecognizedInputError struct { }
UnrecognizedInputError occurs if the input is not recognized as a URL or GitHub repo
func (UnrecognizedInputError) Error ¶
func (e UnrecognizedInputError) Error() string