Add offline option to scan and configtest (#588)

Add offline option to scan and configtest
This commit is contained in:
Kota Kanbe
2018-01-19 01:07:44 +09:00
committed by GitHub
parent a0e0ee6c1e
commit c00404793a
6 changed files with 89 additions and 13 deletions

View File

@@ -21,6 +21,8 @@ import (
"bytes"
"fmt"
"strings"
"github.com/future-architect/vuls/config"
)
// Packages is Map of Package
@@ -62,13 +64,17 @@ func (ps Packages) Merge(other Packages) Packages {
// FormatUpdatablePacksSummary returns a summary of updatable packages
func (ps Packages) FormatUpdatablePacksSummary() string {
if config.Conf.Offline {
return fmt.Sprintf("%d installed", len(ps))
}
nUpdatable := 0
for _, p := range ps {
if p.NewVersion != "" {
nUpdatable++
}
}
return fmt.Sprintf("%d updatable packages", nUpdatable)
return fmt.Sprintf("%d installed, %d updatable", len(ps), nUpdatable)
}
// FindOne search a element by name-newver-newrel-arch