Sha256: 37afd52c222bb948cd6646362b445bfe45d1c0cb7873700388b595a70bb21d1b

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

#!/usr/bin/env ruby

def bail(msg)
  puts msg
  exit(1)
end

$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])

require 'yaml'
require 'teamocil'
require 'optparse'

bail "You must be in a tmux session to use teamocil" unless ENV["TMUX"]

options = {}
opts = OptionParser.new do |opts|
  opts.banner = "Usage: teamocil [options] <layout>

Options:
  "
  opts.on("--here", "Set up the first window in the current window") do
    options[:here] = true
  end

  opts.on("--layout [LAYOUT]", "Use a specific layout file, instead of ~/.teamocil/<layout>.yml") do |layout|
    options[:layout] = layout
  end

end
opts.parse!

if options.include?(:layout)
  file = options[:layout]
else
  file = File.join("#{ENV["HOME"]}/.teamocil", "#{ARGV[0]}.yml")
end

bail "There is no file \"#{file}\"" unless File.exists?(file)

layout = Teamocil::Layout.new(file, options)
layout.to_tmux

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
teamocil-0.1.7 bin/teamocil
teamocil-0.1.6 bin/teamocil
teamocil-0.1.5 bin/teamocil