Add --edit option
This commit is contained in:
parent
b2504f1d05
commit
8ae45f570e
@ -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
|
||||
|
||||
|
12
bin/teamocil
12
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/<layout>.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
|
||||
|
Loading…
Reference in New Issue
Block a user