lib/termup/cli.rb in termup-1.3.0 vs lib/termup/cli.rb in termup-1.3.1

- old
+ new

@@ -10,34 +10,36 @@ def source_root File.expand_path('../../',__FILE__) end end - map "c" => :create - map "e" => :edit - map "l" => :list - map "s" => :start + map 'c' => :create + map 'e' => :edit + map 'l' => :list + map 's' => :start - desc "create PROJECT", "Create termup project (Shortcut: c)" + desc 'create PROJECT', 'Create termup project (Shortcut: c)' def create(project) - empty_directory TERMUP_DIR - template "templates/template.yml", path(project) + edit(project) end - desc "edit PROJECT", "Edit termup project (Shortcut: e)" + desc 'edit PROJECT', 'Edit termup project (Shortcut: e)' def edit(project) - create(project) unless File.exists?(path(project)) - say "please set $EDITOR in your .bash_profile." and return unless editor = ENV['EDITOR'] + unless File.exists?(path(project)) + empty_directory TERMUP_DIR + template 'templates/template.yml', path(project) + end + say 'please set $EDITOR in ~/.bash_profile' and return unless editor = ENV['EDITOR'] system("#{editor} #{path(project)}") end - desc "list", "List termup projects (Shortcut: l)" + desc 'list', 'List termup projects (Shortcut: l)' def list projects = Dir["#{TERMUP_DIR}/*.yml"].map{|file| File.basename(file,'.yml') } say "Your projects: #{projects.join(', ')}" end - desc "start PROJECT", "Start termup project (Shortcut: s)" + desc 'start PROJECT', 'Start termup project (Shortcut: s)' def start(project) say "project \"#{project}\" doesn't exist!" and return unless File.exists?(path(project)) Termup::Base.new(project) end