Skip to content

Commit

Permalink
Add -devices flag to output visible devices
Browse files Browse the repository at this point in the history
  • Loading branch information
pdf committed Aug 21, 2019
1 parent 15b381e commit 08b46b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var (
installFlag bool
developerFlag bool
versionFlag bool
devicesFlag bool
)

type message struct {
Expand Down Expand Up @@ -113,6 +114,7 @@ func init() {
flag.BoolVar(&installFlag, `install`, false, `Perform installation`)
flag.BoolVar(&developerFlag, `dev`, false, `Install as developer`)
flag.BoolVar(&versionFlag, `version`, false, `Display version`)
flag.BoolVar(&devicesFlag, `devices`, false, `Display visible devices`)
flag.Parse()

if devices, err = newDeviceList(); err != nil {
Expand All @@ -137,6 +139,13 @@ func main() {
log(err)
}

if devicesFlag {
for _, dev := range devices.devices {
fmt.Printf("- %s: %s (paired: %v; reachable: %v)\n", dev.Name, dev.ID, dev.IsTrusted, dev.IsReachable)
}
os.Exit(0)
}

go writePump(messageQueue)
readPump(messageQueue)

Expand Down

0 comments on commit 08b46b9

Please sign in to comment.