Class: Termup::Cli
- Inherits:
-
Thor
- Object
- Thor
- Termup::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/termup/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
8 9 10 |
# File 'lib/termup/cli.rb', line 8 def source_root File.('../../',__FILE__) end |
Instance Method Details
#create(project) ⇒ Object
21 22 23 |
# File 'lib/termup/cli.rb', line 21 def create(project) edit(project) end |
#edit(project) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/termup/cli.rb', line 26 def edit(project) unless path(project).exist? empty_directory Termup::Dir if ['iterm_advanced'] template 'templates/iterm_advanced.yml', path(project) elsif ['iterm_basic'] template 'templates/iterm_basic.yml', path(project) else template 'templates/template.yml', path(project) end end say 'please set $EDITOR in ~/.bash_profile' and return unless editor = ENV['EDITOR'] system("#{editor} #{path(project)}") end |
#list ⇒ Object
42 43 44 45 |
# File 'lib/termup/cli.rb', line 42 def list projects = Pathname.glob(Termup::Dir.join('*.yml')).map{|f| f.basename('.yml') } say "Your projects: #{projects.join(', ')}" end |
#start(project) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/termup/cli.rb', line 48 def start(project) say "project \"#{project}\" doesn't exist!" and return unless path(project).exist? process = Termup::Process.new if process.iterm? Termup::Iterm.new(project, process).start else Termup::Terminal.new(project, process).start end end |