lib/zold/commands/show.rb in zold-0.16.27 vs lib/zold/commands/show.rb in zold-0.16.28
- old
+ new
@@ -20,10 +20,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
require 'slop'
require 'rainbow'
+require_relative 'thread_badge'
require_relative 'args'
require_relative '../log'
require_relative '../id'
require_relative '../amount'
require_relative '../wallet'
@@ -33,12 +34,15 @@
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
# License:: MIT
module Zold
# Show command
class Show
- def initialize(wallets:, log: Log::Quiet.new)
+ prepend ThreadBadge
+
+ def initialize(wallets:, copies:, log: Log::NULL)
@wallets = wallets
+ @copies = copies
@log = log
end
def run(args = [])
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
@@ -47,11 +51,11 @@
o.bool '--help', 'Print instructions'
end
mine = Args.new(opts, @log).take || return
if mine.empty?
require_relative 'list'
- List.new(wallets: @wallets, log: @log).run(args)
+ 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)
@@ -67,10 +71,10 @@
balance = wallet.balance
wallet.txns.each do |t|
@log.info(t.to_text)
end
msg = "The balance of #{wallet}: #{balance}"
- msg += " (net:#{wallet.network})" if wallet.network != Wallet::MAIN_NETWORK
+ msg += " (net:#{wallet.network})" if wallet.network != Wallet::MAINET
@log.info(msg)
balance
end
end
end