func (x *cmdHWInfo) doHWInfo() error { // use specific package pkgname := x.Positional.PackageName if pkgname != "" { writePaths, err := snappy.ListHWAccess(pkgname) if err != nil { return err } outputHWAccessForPkgname(pkgname, writePaths) return nil } // no package -> show additional access for all installed snaps return outputHWAccessForAll() }
func outputHWAccessForAll() error { installed, err := snappy.ListInstalled() if err != nil { return err } for _, snap := range installed { writePaths, err := snappy.ListHWAccess(snap.Name()) if err == nil && len(writePaths) > 0 { outputHWAccessForPkgname(snap.Name(), writePaths) } } return nil }