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) }