class Projectionist::CLI

Attributes

projections[RW]

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/projectionist/cli.rb, line 8
def initialize(*)
  @projections = Projectionist::Projections.new
  super
rescue Projectionist::ProjectionError => error
  $stderr.puts "ERROR: #{error.message}"
  exit 1
end

Public Instance Methods

edit(type, file='') click to toggle source
# File lib/projectionist/cli.rb, line 18
def edit(type, file='')
  file = @projections.file_for type, file
  exec "#{editor} #{file}"
end
editor() click to toggle source
# File lib/projectionist/cli.rb, line 36
def editor
  editor = options[:editor] || ENV['VISUAL'] || ENV['EDITOR'] || 'vim'
  editor.empty? ? 'vim' : editor
end
list(type) click to toggle source
# File lib/projectionist/cli.rb, line 26
def list(type)
  puts @projections.files_for(type, verbose: options[:verbose]).join("\n")
end
types() click to toggle source
# File lib/projectionist/cli.rb, line 31
def types
  puts @projections.types.join("\n")
end