github.com/jaypipes/ghw@v0.21.1/cmd/ghwc/commands/pci.go (about) 1 // 2 // Use and distribution licensed under the Apache license version 2. 3 // 4 // See the COPYING file in the root project directory for full text. 5 // 6 7 package commands 8 9 import ( 10 "github.com/jaypipes/ghw" 11 "github.com/pkg/errors" 12 "github.com/spf13/cobra" 13 ) 14 15 // pciCmd represents the install command 16 var pciCmd = &cobra.Command{ 17 Use: "pci", 18 Short: "Show information about PCI devices on the host system", 19 RunE: showPCI, 20 } 21 22 // showPCI shows information for PCI devices on the host system. 23 func showPCI(cmd *cobra.Command, args []string) error { 24 pci, err := ghw.PCI() 25 if err != nil { 26 return errors.Wrap(err, "error getting PCI info") 27 } 28 29 printInfo(pci) 30 return nil 31 } 32 33 func init() { 34 rootCmd.AddCommand(pciCmd) 35 }