Create empty layout file with --edit
This commit is contained in:
parent
54a17fbc01
commit
7de8179b5b
@ -10,6 +10,7 @@ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
|||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'teamocil'
|
require 'teamocil'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
bail "You must be in a tmux session to use teamocil" unless ENV["TMUX"]
|
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")
|
file = File.join("#{ENV["HOME"]}/.teamocil", "#{ARGV[0]}.yml")
|
||||||
end
|
end
|
||||||
|
|
||||||
bail "There is no file \"#{file}\"" unless File.exists?(file)
|
|
||||||
|
|
||||||
if options[:edit]
|
if options[:edit]
|
||||||
|
FileUtils.touch file unless File.exists?(file)
|
||||||
system("$EDITOR \"#{file}\"")
|
system("$EDITOR \"#{file}\"")
|
||||||
else
|
else
|
||||||
|
bail "There is no file \"#{file}\"" unless File.exists?(file)
|
||||||
layout = Teamocil::Layout.new(file, options)
|
layout = Teamocil::Layout.new(file, options)
|
||||||
layout.to_tmux
|
layout.to_tmux
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user