Class: Muxit::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/muxit/cli.rb

Instance Method Summary collapse

Instance Method Details

#attach(name) ⇒ Object



14
15
16
# File 'lib/muxit/cli.rb', line 14

def attach name
  tmux_exec ['tmux', 'attach-session', '-t', name]
end

#code(project) ⇒ Object



24
25
26
27
28
# File 'lib/muxit/cli.rb', line 24

def code project
  name = project.split('/').last
  directory = "#{ENV['PROJECTS']}/#{project}"
  tmux_exec "tmux new-session -s #{name} 'cd #{directory} && #{ENV['EDITOR']}' \\; split-window -h -c #{directory}"
end

#listObject



9
10
11
# File 'lib/muxit/cli.rb', line 9

def list
  tmux_exec ['tmux', 'list-sessions']
end

#nuke(name) ⇒ Object



19
20
21
# File 'lib/muxit/cli.rb', line 19

def nuke name
  tmux_exec ['tmux', 'kill-session', '-t', name]
end

#start(name) ⇒ Object



4
5
6
# File 'lib/muxit/cli.rb', line 4

def start name
  tmux_exec ['tmux', 'new-session', '-s', '#{name}']
end