mirror of
https://github.com/gogrlx/snack.git
synced 2026-04-02 05:08:42 -07:00
flatpak: implements Manager, Cleaner, and RepoManager interfaces - Install/Remove/Purge/Upgrade with flatpak CLI - Repository management (add/remove/list remotes) - Autoremove unused runtimes snap: implements Manager and VersionQuerier interfaces - Install with --classic/--channel support via Target.FromRepo - Remove/Purge/Upgrade via snap CLI - Version queries with semver comparison - Upgrade availability via snap refresh --list Both packages follow the existing pattern: - Exported methods on struct delegate to unexported functions - _linux.go for real implementation, _other.go stubs - Compile-time interface checks - Parser tests for all output formats
45 lines
1009 B
Go
45 lines
1009 B
Go
package flatpak
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogrlx/snack"
|
|
)
|
|
|
|
// Compile-time interface checks.
|
|
var (
|
|
_ snack.Cleaner = (*Flatpak)(nil)
|
|
_ snack.RepoManager = (*Flatpak)(nil)
|
|
)
|
|
|
|
// Autoremove removes unused runtimes and extensions.
|
|
func (f *Flatpak) Autoremove(ctx context.Context, opts ...snack.Option) error {
|
|
f.Lock()
|
|
defer f.Unlock()
|
|
return autoremove(ctx, opts...)
|
|
}
|
|
|
|
// Clean is a no-op for flatpak (no direct cache clean equivalent).
|
|
func (f *Flatpak) Clean(ctx context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
// ListRepos returns all configured remotes.
|
|
func (f *Flatpak) ListRepos(ctx context.Context) ([]snack.Repository, error) {
|
|
return listRepos(ctx)
|
|
}
|
|
|
|
// AddRepo adds a new remote.
|
|
func (f *Flatpak) AddRepo(ctx context.Context, repo snack.Repository) error {
|
|
f.Lock()
|
|
defer f.Unlock()
|
|
return addRepo(ctx, repo)
|
|
}
|
|
|
|
// RemoveRepo removes a configured remote.
|
|
func (f *Flatpak) RemoveRepo(ctx context.Context, id string) error {
|
|
f.Lock()
|
|
defer f.Unlock()
|
|
return removeRepo(ctx, id)
|
|
}
|