Class: Snippit::CLI::List

Inherits:
Object
  • Object
show all
Includes:
IO
Defined in:
lib/snippit/cli/list.rb

Overview

Snippit::CLI::List lists all snippets.

Instance Method Summary collapse

Methods included from IO

#definitions, #definitions_file, #delete_snippet, #filepath!, #read_snippet, #snippit_dir, #snippit_dir!, #write_definition, #write_snippet

Instance Method Details

#startInteger

Starts the list subcommand.

Returns:

  • (Integer)

    the exit code



14
15
16
17
18
19
20
21
# File 'lib/snippit/cli/list.rb', line 14

def start
  out = definitions.map { |slug, name| "#{slug}: #{name}" }

  puts 'No snippets found.' if out.empty?

  puts out
  0
end