lib/zold/commands/list.rb in zold-0.16.24 vs lib/zold/commands/list.rb in zold-0.16.25

- old
+ new

@@ -19,10 +19,11 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. require_relative '../log' +require_relative '../amount' require_relative '../wallet' # LIST command. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:: Copyright (c) 2018 Yegor Bugayenko @@ -34,15 +35,22 @@ @wallets = wallets @log = log end def run(_ = []) + total = 0 + txns = 0 + balance = Amount::ZERO @wallets.all.sort.each do |id| - @wallets.find(id) do |wallet| + total += 1 + @wallets.acq(id) do |wallet| msg = wallet.mnemo msg += " (net:#{wallet.network})" if wallet.network != Wallet::MAIN_NETWORK + txns += wallet.txns.count + balance += wallet.balance @log.info(msg) end end + @log.info("#{total} wallets, #{txns} transactions, #{balance} in total") end end end