From 7de8179b5b26c01c6efeb68756609b7c694e8161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81mi=20Pre=CC=81vost?= Date: Sun, 25 Sep 2011 15:21:38 -0400 Subject: [PATCH] Create empty layout file with --edit --- bin/teamocil | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/teamocil b/bin/teamocil index eba5376..1a9f90a 100755 --- a/bin/teamocil +++ b/bin/teamocil @@ -10,6 +10,7 @@ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) require 'yaml' require 'teamocil' require 'optparse' +require 'fileutils' bail "You must be in a tmux session to use teamocil" unless ENV["TMUX"] @@ -40,11 +41,11 @@ else file = File.join("#{ENV["HOME"]}/.teamocil", "#{ARGV[0]}.yml") end -bail "There is no file \"#{file}\"" unless File.exists?(file) - if options[:edit] + FileUtils.touch file unless File.exists?(file) system("$EDITOR \"#{file}\"") else + bail "There is no file \"#{file}\"" unless File.exists?(file) layout = Teamocil::Layout.new(file, options) layout.to_tmux end