1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main
import (
"fmt"
"os"
"git.zaphyra.eu/airpodsctl/helpers"
)
func (state State) listDevicesCommand() {
if len(state.Devices) < 1 {
fmt.Fprintln(os.Stderr, "No devices connected!")
os.Exit(1)
}
fmt.Fprintln(os.Stdout, helpers.BoldText("[MAC-Address]\t\tConnected\tName"))
for _, device := range state.Devices {
fmt.Fprintf(os.Stdout, "[%s]\t%s\t\t%s\n", device.Address, device.Connected, device.Name)
}
os.Exit(0)
}