mirror of
https://github.com/mudler/luet.git
synced 2025-09-16 07:10:29 +00:00
Add Explain() to Assertions and Packages
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
package solver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
pkg "github.com/mudler/luet/pkg/package"
|
||||
)
|
||||
|
||||
@@ -40,3 +42,18 @@ func DecodeModel(model map[string]bool) ([]PackageAssert, error) {
|
||||
}
|
||||
return ass, nil
|
||||
}
|
||||
|
||||
func (a *PackageAssert) Explain() {
|
||||
fmt.Println(a.ToString())
|
||||
a.Package.Explain()
|
||||
}
|
||||
|
||||
func (a *PackageAssert) ToString() string {
|
||||
var msg string
|
||||
if a.Package.Flagged() {
|
||||
msg = "installed"
|
||||
} else {
|
||||
msg = "not installed"
|
||||
}
|
||||
return fmt.Sprintf("%s/%s %s %s: %t", a.Package.GetCategory(), a.Package.GetName(), a.Package.GetVersion(), msg, a.Value)
|
||||
}
|
||||
|
Reference in New Issue
Block a user