Class: Arcanus::Command::Show

Inherits:
Base
  • Object
show all
Includes:
Arcanus::Command::Shared::EnsureKey
Defined in:
lib/arcanus/command/show.rb

Instance Method Summary collapse

Methods included from Arcanus::Command::Shared::EnsureKey

#ensure_key_unlocked

Methods inherited from Base

description, #execute_command, from_arguments, #initialize, #run, short_name

Methods included from Utils

camel_case, deep_dup, snake_case

Constructor Details

This class inherits a constructor from Arcanus::Command::Base

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/arcanus/command/show.rb', line 9

def execute
  ensure_key_unlocked

  key = Arcanus::Key.from_file(repo.unlocked_key_path)
  chest = Arcanus::Chest.new(key: key, chest_file_path: repo.chest_file_path)

  if arguments.size > 1
    # Print specific key
    ui.print chest.get(arguments[1])
  else
    # Print entire hash
    output_colored_hash(chest.contents)
  end
end