Skip to content

Commit

Permalink
doc: remove unnecessary examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerourke committed Nov 4, 2021
1 parent d06ca03 commit e074eb7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 239 deletions.
49 changes: 0 additions & 49 deletions class_test.go

This file was deleted.

16 changes: 1 addition & 15 deletions devcon.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ func (dc *DevCon) run(command command, args ...string) ([]string, error) {
dc.RemotePath = ""

if dc.ExeFilePath == "" {
return readTestDataFile(command)
// return nil, errors.New("invalid devcon.exe path specified")
return nil, errors.New("invalid devcon.exe path specified")
}

if _, err := os.Stat(dc.ExeFilePath); os.IsNotExist(err) {
Expand Down Expand Up @@ -174,16 +173,3 @@ func (dc *DevCon) logResults(lines []string) {
fmt.Println(line)
}
}

func readTestDataFile(command command) ([]string, error) {
fileName := fmt.Sprintf("%s.txt", command.String())

path := filepath.Join("testdata", fileName)

bytes, err := ioutil.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("error reading test data file: %w", err)
}

return splitLines(string(bytes)), nil
}
38 changes: 38 additions & 0 deletions devcon_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package devcon_test

import (
"fmt"
"strings"

"github.com/mikerourke/go-devcon"
)

func Example_install() {
dc := devcon.New(`C:\windows\devcon.exe`)

devs, err := dc.Find("*VEN_8086*")
if err != nil {
fmt.Println(err)

return
}

var matchingDev devcon.Device

for _, dev := range devs {
if strings.Contains(dev.Name, "PRO") {
matchingDev = dev
break
}
}

if matchingDev.ID != "" {
err = dc.Install(`C:\drivers\PRO1000\WIN32\E1000325.INF`, matchingDev.ID)
if err != nil {
fmt.Printf("error installing: %s", err)
} else {
fmt.Println("Successfully installed")

}
}
}
91 changes: 0 additions & 91 deletions device_test.go

This file was deleted.

32 changes: 0 additions & 32 deletions driver_test.go

This file was deleted.

35 changes: 0 additions & 35 deletions hwids_test.go

This file was deleted.

17 changes: 0 additions & 17 deletions oem_test.go

This file was deleted.

0 comments on commit e074eb7

Please sign in to comment.