-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
64 lines (55 loc) · 1.48 KB
/
main.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"log"
"os"
"os/signal"
fu "github.com/danielpaulus/go-simulator-dump/fileutil"
"github.com/danielpaulus/go-simulator-dump/proxy"
"github.com/docopt/docopt-go"
)
func main() {
Main()
}
const version = "v 0.01"
// Main Exports main for testing
func Main() {
usage := `iOS client v 0.01
Usage:
sim listen [<sock>]
sim ls
The commands work as following:
sim ls will dump a list of currently active testmanagerd simulator sockets. Copy paste a path out of there to use with listen
sim listen will either take the first available simulator that is running or you can pass it a socket path for a specific sim if you want. once it is running, start a xcuitest in xcode and watch the files with DTX dump being created
`
arguments, err := docopt.ParseDoc(usage)
if err != nil {
log.Fatal(err)
}
ls, _ := arguments.Bool("ls")
if ls {
list, err := fu.ListSockets()
if err != nil {
log.Printf("Could not get sockets because: %s", err)
return
}
log.Println(list)
return
}
sock, _ := arguments.String("<sock>")
if sock == "" {
log.Print("No socket specified, trying to find active sockets..")
sock, err = fu.FirstSocket()
if err != nil {
log.Fatal("could not find socket")
}
log.Printf("Using socket:%s", sock)
}
newSocket, _ := fu.MoveSock(sock)
handle := proxy.Launch(sock, newSocket)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
log.Print("CTRL+C detected, shutting down")
handle.Stop()
fu.MoveBack(sock)
}