Add --edit option

This commit is contained in:
Rémi Prévost 2011-07-20 13:17:10 -04:00
parent b2504f1d05
commit 8ae45f570e
2 changed files with 11 additions and 2 deletions

View File

@ -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 doesnt create an empty first window. * `--here` opens the session from the current window, it doesnt create an empty first window.
* `--layout` takes a custom file path to a YAML layout file. * `--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 ## Layout example

View File

@ -23,6 +23,10 @@ Options:
options[:here] = true options[:here] = true
end 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/<layout>.yml") do |layout| opts.on("--layout [LAYOUT]", "Use a specific layout file, instead of ~/.teamocil/<layout>.yml") do |layout|
options[:layout] = layout options[:layout] = layout
end end
@ -38,5 +42,9 @@ end
bail "There is no file \"#{file}\"" unless File.exists?(file) bail "There is no file \"#{file}\"" unless File.exists?(file)
if options[:edit]
system("$EDITOR \"#{file}\"")
else
layout = Teamocil::Layout.new(file, options) layout = Teamocil::Layout.new(file, options)
layout.to_tmux layout.to_tmux
end