Class: ItsyBtc::Commands::ListCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/itsy-btc/commands/list_command.rb

Instance Attribute Summary

Attributes inherited from Command

#wallet

Instance Method Summary collapse

Methods inherited from Command

args, name, summary

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/itsy-btc/commands/list_command.rb', line 7

def run
  if @wallet.nil?
    puts "No wallet found! Use `itsy init` to create one."
    exit
  end

  entries = @wallet.entries
  if entries.empty?
    puts "This wallet is empty."
  else
    puts "Address                             Comment"
    entries.each do |entry|
      puts "#{entry.address}  #{entry.comment}"
    end
  end
end