Sha256: e1e0cbde2b16a01b0aa2e62bf8772046715dea9f83a621be4193e6ef89bcc83d
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'thor' module Termup TERMUP_DIR = File.join(ENV['HOME'],'.config','termup') class Cli < Thor include Thor::Actions class << self def source_root File.expand_path('../../',__FILE__) end end map "c" => :create map "e" => :edit map "l" => :list map "s" => :start desc "create PROJECT", "Create termup project (Shortcut: c)" def create(project) empty_directory TERMUP_DIR template "templates/template.yml", path(project) end desc "edit PROJECT", "Edit termup project (Shortcut: e)" def edit(project) say "please set $EDITOR in your .bash_profile." and return unless editor = ENV['EDITOR'] system("#{editor} #{path(project)}") end 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)" def start(project) Termup::Base.new(project) end protected def path(project) "#{TERMUP_DIR}/#{project}.yml" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
termup-1.0.1 | lib/termup/cli.rb |