Class: CodeSnippet::Commands::ListSnippets

Inherits:
Object
  • Object
show all
Defined in:
lib/code_snippet/commands/list_snippets.rb

Overview

Lists snippets in STDOUT

Constant Summary collapse

RESULT_HEADER =

Output table header

%w[NAME LANG].freeze

Instance Method Summary collapse

Constructor Details

#initialize(manager, options = Hashie::Mash.new) ⇒ ListSnippets

Returns a new instance of ListSnippets.



13
14
15
16
17
# File 'lib/code_snippet/commands/list_snippets.rb', line 13

def initialize(manager, options = Hashie::Mash.new)
  @manager = manager
  @options = options
  @prompt = TTY::Prompt.new
end

Instance Method Details

#runObject

Prints a list of snippets to STDOUT



22
23
24
# File 'lib/code_snippet/commands/list_snippets.rb', line 22

def run
  puts(snippet_list_table.render.strip)
end