feat: get ios running processes by ps

This commit is contained in:
debugtalk
2022-10-01 23:46:24 +08:00
parent fdc9f382d4
commit 0a051a1f34
5 changed files with 94 additions and 33 deletions
+24 -1
View File
@@ -1,12 +1,35 @@
package ios
import "github.com/spf13/cobra"
import (
"fmt"
"os"
giDevice "github.com/electricbubble/gidevice"
"github.com/spf13/cobra"
"github.com/httprunner/httprunner/v4/hrp/internal/uixt"
)
var iosRootCmd = &cobra.Command{
Use: "ios",
Short: "simple utils for ios device management",
}
func getDevice(udid string) (giDevice.Device, error) {
devices, err := uixt.IOSDevices(udid)
if err != nil {
return nil, err
}
if len(devices) == 0 {
fmt.Println("no ios device found")
os.Exit(1)
}
if len(devices) > 1 {
return nil, fmt.Errorf("multiple devices found, please specify udid")
}
return devices[0], nil
}
func Init(rootCmd *cobra.Command) {
rootCmd.AddCommand(iosRootCmd)
}