Class: Snip::Command::Show

Inherits:
Object
  • Object
show all
Defined in:
lib/snip/command/show.rb

Instance Method Summary collapse

Constructor Details

#initialize(args, options = {}) ⇒ Show

Returns a new instance of Show.



6
7
8
9
# File 'lib/snip/command/show.rb', line 6

def initialize(args, options={})
  @args = Array(args)
  @options = options
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
# File 'lib/snip/command/show.rb', line 11

def execute
  name = @args
  raise NotInitializedError unless Snip::initialized?
  raise SnippetNotFoundError unless Snip::snippet_exists?(name)

  puts File.read(File.join(Snip::INSTALL_DIR, name)).color(:magenta)
end