mirror of
https://github.com/gogrlx/snack.git
synced 2026-04-01 20:58:42 -07:00
- Update go.mod from Go 1.26.0 to 1.26.1 - Update dependencies: golang.org/x/sync, golang.org/x/sys, charmbracelet/x/exp/charmtone, mattn/go-runewidth - Fix goimports formatting in 10 files - Add apk/normalize_test.go: tests for normalizeName and parseArchNormalize with all known arch suffixes - Add rpm/parse_test.go: tests for parseList, parseInfo, parseArchSuffix, and normalizeName (all at 100% coverage) - All tests pass with -race, staticcheck and go vet clean
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package snack
|
|
|
|
// Capabilities reports which optional interfaces a Manager implements.
|
|
// Useful for grlx to determine what operations are available before
|
|
// attempting them.
|
|
type Capabilities struct {
|
|
VersionQuery bool
|
|
Hold bool
|
|
Clean bool
|
|
FileOwnership bool
|
|
RepoManagement bool
|
|
KeyManagement bool
|
|
Groups bool
|
|
NameNormalize bool
|
|
DryRun bool
|
|
PackageUpgrade bool
|
|
}
|
|
|
|
// GetCapabilities probes a Manager for all optional interface support.
|
|
func GetCapabilities(m Manager) Capabilities {
|
|
_, vq := m.(VersionQuerier)
|
|
_, h := m.(Holder)
|
|
_, c := m.(Cleaner)
|
|
_, fo := m.(FileOwner)
|
|
_, rm := m.(RepoManager)
|
|
_, km := m.(KeyManager)
|
|
_, g := m.(Grouper)
|
|
_, nn := m.(NameNormalizer)
|
|
_, dr := m.(DryRunner)
|
|
_, pu := m.(PackageUpgrader)
|
|
return Capabilities{
|
|
VersionQuery: vq,
|
|
Hold: h,
|
|
Clean: c,
|
|
FileOwnership: fo,
|
|
RepoManagement: rm,
|
|
KeyManagement: km,
|
|
Groups: g,
|
|
NameNormalize: nn,
|
|
DryRun: dr,
|
|
PackageUpgrade: pu,
|
|
}
|
|
}
|