Class: Raykit::Wt

Inherits:
Object
  • Object
show all
Defined in:
lib/raykit/wt.rb

Class Method Summary collapse

Class Method Details

.get_tab_arg(url) ⇒ Object



22
23
24
25
26
# File 'lib/raykit/wt.rb', line 22

def self.get_tab_arg(url)
  dir = Raykit::Git::Repository.new(url).get_dev_dir("work")
  name = File.basename(dir)
  "-d #{dir} --title #{name}"
end

.open(names) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/raykit/wt.rb', line 3

def self.open(names)
  if names.is_a? String
    cmd = Raykit::Command.new("wt --maximized #{get_tab_arg(names)}").run
  end
  if names.is_a?(Array)
    cmd = "wt --maximized "
    index = 0
    names.each { |url|
      if index <= 0
        cmd += get_tab_arg(url)
      else
        cmd += ";new-tab " + get_tab_arg(url)
      end
      index = index + 1
    }
    Raykit::Command.new(cmd).run
  end
end