feat: add pkg (FreeBSD) and ports (OpenBSD) package manager implementations

pkg implements Manager, VersionQuerier, Cleaner, and FileOwner interfaces
wrapping FreeBSD's pkg(8) CLI. ports implements Manager wrapping OpenBSD's
pkg_add/pkg_delete/pkg_info tools.

Both use build tags (freebsd/openbsd) for real implementations with stub
files for other platforms. Includes parser tests for all output formats.
This commit is contained in:
2026-02-26 01:11:23 +00:00
parent 14ba7cfb53
commit 99dfe59f40
6 changed files with 640 additions and 0 deletions

51
ports/ports_other.go Normal file
View File

@@ -0,0 +1,51 @@
//go:build !openbsd
package ports
import (
"context"
"github.com/gogrlx/snack"
)
func available() bool { return false }
func install(_ context.Context, _ []snack.Target, _ ...snack.Option) error {
return snack.ErrUnsupportedPlatform
}
func remove(_ context.Context, _ []snack.Target, _ ...snack.Option) error {
return snack.ErrUnsupportedPlatform
}
func purge(_ context.Context, _ []snack.Target, _ ...snack.Option) error {
return snack.ErrUnsupportedPlatform
}
func upgrade(_ context.Context, _ ...snack.Option) error {
return snack.ErrUnsupportedPlatform
}
func update(_ context.Context) error {
return snack.ErrUnsupportedPlatform
}
func list(_ context.Context) ([]snack.Package, error) {
return nil, snack.ErrUnsupportedPlatform
}
func search(_ context.Context, _ string) ([]snack.Package, error) {
return nil, snack.ErrUnsupportedPlatform
}
func info(_ context.Context, _ string) (*snack.Package, error) {
return nil, snack.ErrUnsupportedPlatform
}
func isInstalled(_ context.Context, _ string) (bool, error) {
return false, snack.ErrUnsupportedPlatform
}
func version(_ context.Context, _ string) (string, error) {
return "", snack.ErrUnsupportedPlatform
}