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
10 11 12 |
# File 'lib/termup/cli.rb', line 10 def source_root File.('../../',__FILE__) end |
Instance Method Details
#create(project) ⇒ Object
23 24 25 |
# File 'lib/termup/cli.rb', line 23 def create(project) edit(project) end |
#edit(project) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/termup/cli.rb', line 28 def edit(project) unless File.exists?(path(project)) 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
44 45 46 47 |
# File 'lib/termup/cli.rb', line 44 def list projects = Dir["#{TERMUP_DIR}/*.yml"].map{|file| File.basename(file,'.yml') } say "Your projects: #{projects.join(', ')}" end |