add remote flag to send remote commands to server

Mentioned in #45.
This commit is contained in:
Gokcehan committed 2016-12-19 21:28:57 +03:00
1 parent 2085b6d797
commit 0298630114
3 files changed
+13 -5

No files matched your search

+10 -2
View File
@@ -72,6 +72,7 @@ func startServer() {
func main() {
showDoc := flag.Bool("doc", false, "show documentation")
remoteCmd := flag.String("remote", "", "send remote command to server")
serverMode := flag.Bool("server", false, "start server (automatic)")
cpuprofile := flag.String("cpuprofile", "", "path to the file to write the cpu profile")
flag.StringVar(&gLastDirPath, "last-dir-path", "", "path to the file to write the last dir on exit (to use for cd)")
@@ -84,13 +85,20 @@ func main() {
return
}
if *remoteCmd != "" {
if err := sendRemote(*remoteCmd); err != nil {
log.Fatalf("remote command: %s", err)
}
return
}
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal("could not create CPU profile: ", err)
log.Fatalf("could not create CPU profile: %s", err)
}
if err := pprof.StartCPUProfile(f); err != nil {
log.Fatal("could not start CPU profile: ", err)
log.Fatalf("could not start CPU profile: %s", err)
}
defer pprof.StopCPUProfile()
}