From 63d4bafd0c9c95bb23d8967e8a03e4b04098cfd5 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 31 Jan 2014 12:20:50 +0100 Subject: [PATCH] cammount: add -term flag, like -xterm but different Change-Id: Idd81e345c4995a0ee939a2b4fe01d339f44ba526 --- cmd/cammount/cammount.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/cammount/cammount.go b/cmd/cammount/cammount.go index b85a4b353..8655c555a 100644 --- a/cmd/cammount/cammount.go +++ b/cmd/cammount/cammount.go @@ -36,6 +36,7 @@ import ( "camlistore.org/pkg/cacher" "camlistore.org/pkg/client" "camlistore.org/pkg/fs" + "camlistore.org/pkg/osutil" "camlistore.org/pkg/search" "camlistore.org/third_party/bazil.org/fuse" fusefs "camlistore.org/third_party/bazil.org/fuse/fs" @@ -44,6 +45,7 @@ import ( var ( debug = flag.Bool("debug", false, "print debugging messages.") xterm = flag.Bool("xterm", false, "Run an xterm in the mounted directory. Shut down when xterm ends.") + term = flag.Bool("term", false, "Open a terminal window. Doesn't shut down when exited. Mostly for demos.") open = flag.Bool("open", false, "Open a GUI window") ) @@ -178,8 +180,16 @@ func main() { } if *open { if runtime.GOOS == "darwin" { - cmd := exec.Command("open", mountPoint) - go cmd.Run() + go exec.Command("open", mountPoint).Run() + } + } + if *term { + if runtime.GOOS == "darwin" { + if osutil.DirExists("/Applications/iTerm.app/") { + go exec.Command("open", "-a", "iTerm", mountPoint).Run() + } else { + log.Printf("TODO: iTerm not installed. Figure out how to open with Terminal.app instead.") + } } }