From bd247fef356bd2a561f112703ddee47fd1022a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Pr=C3=A9vost?= Date: Sat, 5 Feb 2011 13:54:34 -0500 Subject: [PATCH] Check for ENV["TMUX"] when using teamocil --- README.mkd | 1 + bin/teamocil | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.mkd b/README.mkd index dc22023..30253c6 100644 --- a/README.mkd +++ b/README.mkd @@ -7,6 +7,7 @@ Teamocil is a tool used to automatically create windows and splits in `tmux` wit $ gem install teamocil $ mkdir ~/.teamocil $ touch ~/.teamocil/sample.yml + $ tmux $ teamocil sample # Layout example diff --git a/bin/teamocil b/bin/teamocil index 2c9b4e1..9bf3c9a 100755 --- a/bin/teamocil +++ b/bin/teamocil @@ -1,6 +1,10 @@ #!/usr/bin/env ruby -require "teamocil" +require File.dirname(__FILE__)+"/../lib/teamocil" -layout = Teamocil::Layout.new(ARGV[0], File.join("#{ENV["HOME"]}/.teamocil", "#{ARGV[0]}.yml")) -layout.to_tmux +if ENV["TMUX"] == nil + puts "You must be in a tmux session to use teamocil" +else + layout = Teamocil::Layout.new(ARGV[0], File.join("#{ENV["HOME"]}/.teamocil", "#{ARGV[0]}.yml")) + layout.to_tmux +end