Documentation
¶
Index ¶
- Constants
- func CleanupBackup(backup *BackupInfo)
- func CleanupDownload(result *DownloadResult)
- func CompareVersions(current, latest string) (int, error)
- func ExtractBinary(archivePath string, platform *PlatformInfo) (string, error)
- func FetchChecksums(version string) (map[string]string, error)
- func FindAllInstallations() []string
- func GetArch() string
- func GetCurrentVersion() string
- func GetExecutablePath() (string, error)
- func GetInstallDir() string
- func GetLatestVersion() (string, error)
- func GetOS() string
- func InstallBinary(sourcePath, destPath string) error
- func InstallToMultipleLocations(sourcePath string, locations []string) ([]string, []error)
- func IsNewerAvailable(current, latest string) (bool, error)
- func NewCommand() *cobra.Command
- func NormalizeVersion(v string) string
- func RestoreBackup(backup *BackupInfo) error
- func SetCurrentVersion(v string)
- func VerifyChecksum(filePath, expectedHash string) error
- func VerifyInstallation(binaryPath string) error
- type BackupInfo
- type DownloadResult
- type GitHubRelease
- type PlatformInfo
- type ProgressCallback
- type UpgradeResult
- type Version
Constants ¶
View Source
const ( BinaryName = "haft" RepoOwner = "KashifKhn" RepoName = "haft" )
View Source
const ( GitHubAPIURL = "https://api.github.com/repos/%s/%s/releases/latest" RequestTimeout = 30 * time.Second UserAgent = "haft-cli" MaxRetries = 3 RetryDelay = 2 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CleanupBackup ¶
func CleanupBackup(backup *BackupInfo)
func CleanupDownload ¶
func CleanupDownload(result *DownloadResult)
func CompareVersions ¶
func ExtractBinary ¶
func ExtractBinary(archivePath string, platform *PlatformInfo) (string, error)
func FindAllInstallations ¶
func FindAllInstallations() []string
func GetCurrentVersion ¶
func GetCurrentVersion() string
func GetExecutablePath ¶
func GetInstallDir ¶
func GetInstallDir() string
func GetLatestVersion ¶
func InstallBinary ¶
func IsNewerAvailable ¶
func NewCommand ¶
func NormalizeVersion ¶
func RestoreBackup ¶
func RestoreBackup(backup *BackupInfo) error
func SetCurrentVersion ¶
func SetCurrentVersion(v string)
func VerifyChecksum ¶
func VerifyInstallation ¶
Types ¶
type BackupInfo ¶
func CreateBackup ¶
func CreateBackup(binaryPath string) (*BackupInfo, error)
type DownloadResult ¶
func DownloadRelease ¶
func DownloadRelease(version string, platform *PlatformInfo) (*DownloadResult, error)
func DownloadReleaseWithProgress ¶ added in v0.1.16
func DownloadReleaseWithProgress(version string, platform *PlatformInfo, progress ProgressCallback) (*DownloadResult, error)
type GitHubRelease ¶
type PlatformInfo ¶
func GetPlatformInfo ¶
func GetPlatformInfo() (*PlatformInfo, error)
func (*PlatformInfo) GetArchiveName ¶
func (p *PlatformInfo) GetArchiveName(version string) string
func (*PlatformInfo) GetBinaryNameInArchive ¶
func (p *PlatformInfo) GetBinaryNameInArchive() string
func (*PlatformInfo) GetChecksumsURL ¶
func (p *PlatformInfo) GetChecksumsURL(version string) string
func (*PlatformInfo) GetDownloadURL ¶
func (p *PlatformInfo) GetDownloadURL(version string) string
func (*PlatformInfo) String ¶
func (p *PlatformInfo) String() string
type ProgressCallback ¶ added in v0.1.16
type ProgressCallback func(downloaded, total int64)
type UpgradeResult ¶
type UpgradeResult struct {
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
UpdateAvailable bool `json:"update_available"`
Upgraded bool `json:"upgraded"`
Platform struct {
OS string `json:"os"`
Arch string `json:"arch"`
} `json:"platform"`
InstalledPaths []string `json:"installed_paths,omitempty"`
Error string `json:"error,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.