Class: Ace::Demo::CLI::Commands::Show

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/demo/cli/commands/show.rb

Instance Method Summary collapse

Instance Method Details

#call(tape:) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ace/demo/cli/commands/show.rb', line 17

def call(tape:, **)
  entry = Molecules::TapeScanner.new.find(tape)

  puts "Tape: #{entry[:name]}"
  puts "Source: #{entry[:display_path]}"
  puts "Format: #{entry[:format]}"
  puts "Description: #{entry[:description]}" if entry[:description]

  (entry[:metadata]) if entry[:format] == "yaml"
  (entry[:metadata]) if entry[:format] != "yaml"

  puts
  puts "--- Contents ---"
  print entry[:content]
rescue TapeNotFoundError, ArgumentError => e
  raise Ace::Support::Cli::Error, e.message
end