Documentation ¶
Index ¶
- type Package
- type PackageManager
- type PackageManagerRegistry
- type ScoopPackageManager
- func (scoopPackageManager *ScoopPackageManager) Install() error
- func (scoopPackageManager *ScoopPackageManager) InstallPackage(packageName string, version *Version) (*Version, error)
- func (scoopPackageManager *ScoopPackageManager) InstalledPackages() ([]*Package, error)
- func (scoopPackageManager *ScoopPackageManager) IsInstalled() (bool, error)
- func (scoopPackageManager *ScoopPackageManager) IsSupported() bool
- func (scoopPackageManager *ScoopPackageManager) Name() string
- func (scoopPackageManager *ScoopPackageManager) Uninstall() error
- func (scoopPackageManager *ScoopPackageManager) UninstallPackage(packageName string) error
- func (scoopPackageManager *ScoopPackageManager) Update() error
- func (scoopPackageManager *ScoopPackageManager) UpdatePackage(packageName string, version *Version) (*Version, error)
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageManager ¶
type PackageManager interface { // Name returns the name of the package manager. Name() string // IsSupported returns whether the package manager is supported on the current machine. IsSupported() bool // IsInstalled returns whether the package manager is installed. IsInstalled() (bool, error) // Install installs the package manager. Install() error // Update updates the package manager. Update() error // Uninstall uninstalls the package manager. Uninstall() error // InstalledPackages returns a slice containing information about all packages that are installed. InstalledPackages() ([]*Package, error) // InstallPackage installs the package of the given name. If a version is given, that specific version of the // package is installed. Otherwise, the latest version is installed. // // It takes the following parameters: // - packageName: The name of the package to install. // - version: The version of the package to install. If nil, the latest version is installed. // // It returns the version of the package that was installed. InstallPackage(packageName string, version *Version) (*Version, error) // UpdatePackage updates the package of the given name. If a version is given, that specific version of the package // is installed. Otherwise, the latest version is installed. // // It takes the following parameters: // - packageName: The name of the package to install. // - version: The version of the package to install. If nil, the latest version is installed. // // It returns the version of the package that was installed. UpdatePackage(packageName string, version *Version) (*Version, error) // UninstallPackage uninstalls the package of the given name. UninstallPackage(packageName string) error }
PackageManager represents a package manager that is supported by Familiar.sh.
type PackageManagerRegistry ¶
type PackageManagerRegistry map[string]PackageManager
func NewPackageManagerRegistry ¶
func NewPackageManagerRegistry(scoopPackageManager *ScoopPackageManager) PackageManagerRegistry
NewPackageManagerRegistry returns a new instance of PackageManagerRegistry.
func (PackageManagerRegistry) GetAllPackageManagers ¶
func (packageManagerRegistry PackageManagerRegistry) GetAllPackageManagers() []PackageManager
GetAllPackageManagers returns a slice containing all package managers.
func (PackageManagerRegistry) GetPackageManager ¶
func (packageManagerRegistry PackageManagerRegistry) GetPackageManager(packageManagerName string) (PackageManager, error)
GetPackageManager returns the package manager with the given name, if it exists.
It takes the following parameters:
- packageManagerName: The name of the package manager.
type ScoopPackageManager ¶
type ScoopPackageManager struct {
// contains filtered or unexported fields
}
ScoopPackageManager implements the PackageManager interface for the Scoop package manager.
func NewScoopPackageManager ¶
func NewScoopPackageManager(operatingSystemService *system.OperatingSystemService, shellCommandService *system.ShellCommandService) *ScoopPackageManager
NewScoopPackageManager returns a new instance of ScoopPackageManager.
func (*ScoopPackageManager) Install ¶
func (scoopPackageManager *ScoopPackageManager) Install() error
Install installs the package manager.
func (*ScoopPackageManager) InstallPackage ¶
func (scoopPackageManager *ScoopPackageManager) InstallPackage(packageName string, version *Version) (*Version, error)
InstallPackage installs the package of the given name. If a version is given, that specific version of the package is installed. Otherwise, the latest version is installed.
It returns the version of the package that was installed.
func (*ScoopPackageManager) InstalledPackages ¶
func (scoopPackageManager *ScoopPackageManager) InstalledPackages() ([]*Package, error)
InstalledPackages returns a slice containing information about all packages that are installed.
func (*ScoopPackageManager) IsInstalled ¶
func (scoopPackageManager *ScoopPackageManager) IsInstalled() (bool, error)
IsInstalled returns true if the package manager is installed.
func (*ScoopPackageManager) IsSupported ¶
func (scoopPackageManager *ScoopPackageManager) IsSupported() bool
IsSupported returns whether the package manager is supported on the current machine.
func (*ScoopPackageManager) Name ¶
func (scoopPackageManager *ScoopPackageManager) Name() string
Name returns the name of the package manager.
func (*ScoopPackageManager) Uninstall ¶
func (scoopPackageManager *ScoopPackageManager) Uninstall() error
Uninstall uninstalls the package manager.
func (*ScoopPackageManager) UninstallPackage ¶
func (scoopPackageManager *ScoopPackageManager) UninstallPackage(packageName string) error
UninstallPackage uninstalls the package of the given name.
func (*ScoopPackageManager) Update ¶
func (scoopPackageManager *ScoopPackageManager) Update() error
Update updates the package manager.
func (*ScoopPackageManager) UpdatePackage ¶
func (scoopPackageManager *ScoopPackageManager) UpdatePackage(packageName string, version *Version) (*Version, error)
UpdatePackage updates the package of the given name. If a version is given, that specific version of the package is installed. Otherwise, the latest version is installed.
It returns the version of the package that was installed.
type Version ¶
type Version struct {
VersionString string
}
Version represents a version of a package or package manager.
func NewVersion ¶
NewVersion creates a new instance of Version.
func (*Version) IsGreaterThan ¶
IsGreaterThan returns whether the version is greater than the other version.
func (*Version) IsLessThan ¶
IsLessThan returns whether the version is less than the other version.