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.
|
* `--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.
|
* `--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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user