From 8ae45f570e36c77eac7bcf2c64df193bc23349c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81mi=20Pre=CC=81vost?= Date: Wed, 20 Jul 2011 13:17:10 -0400 Subject: [PATCH] Add --edit option --- README.mkd | 1 + bin/teamocil | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.mkd b/README.mkd index 922801d..9707269 100644 --- a/README.mkd +++ b/README.mkd @@ -14,6 +14,7 @@ Teamocil is a tool used to automatically create sessions, windows and splits in * `--here` opens the session from the current window, it doesn’t create an empty first window. * `--layout` takes a custom file path to a YAML layout file. +* `--edit` opens the layout file (whether or not `--layout` is used) with `$EDITOR`. ## Layout example diff --git a/bin/teamocil b/bin/teamocil index 689f646..eba5376 100755 --- a/bin/teamocil +++ b/bin/teamocil @@ -23,6 +23,10 @@ Options: options[:here] = true end + opts.on("--edit", "Edit the YAML layout file instead of using it") do + options[:edit] = true + end + opts.on("--layout [LAYOUT]", "Use a specific layout file, instead of ~/.teamocil/.yml") do |layout| options[:layout] = layout end @@ -38,5 +42,9 @@ end bail "There is no file \"#{file}\"" unless File.exists?(file) -layout = Teamocil::Layout.new(file, options) -layout.to_tmux +if options[:edit] + system("$EDITOR \"#{file}\"") +else + layout = Teamocil::Layout.new(file, options) + layout.to_tmux +end