1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main
import (
"fmt"
"os"
"git.zaphyra.eu/airpodsctl/types"
)
func (state State) dumpDeviceStateCommand() {
device, err := state.Devices.Get(state.SelectedDevice)
if err != nil {
fmt.Fprintf(os.Stderr, "[dumpDeviceStateCommand] Error: Device '%s' is not connected!\n", state.SelectedDevice)
os.Exit(1)
}
switch state.OutputFormat {
case types.FormatWaybar:
fmt.Fprint(os.Stdout, device.FormatWaybarString())
case types.FormatCLI:
output, _ := device.FormatCLIString()
fmt.Fprint(os.Stdout, output)
}
os.Exit(0)
}