Class: Zold::Show
- Inherits:
-
Object
- Object
- Zold::Show
- Includes:
- ThreadBadge
- Defined in:
- lib/zold/commands/show.rb
Overview
Show command
Instance Method Summary collapse
-
#initialize(wallets:, copies:, log: Log::NULL) ⇒ Show
constructor
A new instance of Show.
- #run(args = []) ⇒ Object
Constructor Details
Instance Method Details
#run(args = []) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/zold/commands/show.rb', line 50 def run(args = []) @log.debug("Show.run(#{args.join(' ')})") opts = Slop.parse(args, help: true, suppress_errors: true) do |o| o. = "Usage: zold show [ID...] [options] Available options:" o.bool '--help', 'Print instructions' end mine = Args.new(opts, @log).take || return if mine.empty? require_relative 'list' List.new(wallets: @wallets, copies: @copies, log: @log).run(args) else total = Amount::ZERO mine.map { |i| Id.new(i) }.each do |id| @wallets.acq(id) do |w| total += show(w, opts) end end total end end |