refactor: get attached android/ios devices

This commit is contained in:
lilong.129
2023-04-14 15:26:16 +08:00
parent f77b454cf2
commit c97b84dd39
6 changed files with 70 additions and 79 deletions

View File

@@ -70,18 +70,10 @@ var listDevicesCmd = &cobra.Command{
Short: "List all iOS devices",
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
RunE: func(cmd *cobra.Command, args []string) error {
devices, err := uixt.IOSDevices(udid)
devices, err := uixt.GetIOSDevices(udid)
if err != nil {
return err
}
if len(devices) == 0 {
if udid != "" {
fmt.Printf("no ios device found for udid: %s\n", udid)
os.Exit(1)
} else {
fmt.Println("no ios device found")
os.Exit(0)
}
fmt.Println(err)
os.Exit(0)
}
for _, d := range devices {