lib/zold/commands/create.rb in zold-0.0.8 vs lib/zold/commands/create.rb in zold-0.1

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2018 Zerocracy, Inc. +# Copyright (c) 2018 Yegor Bugayenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -22,25 +22,27 @@ require_relative '../log.rb' require_relative '../id.rb' # CREATE command. # Author:: Yegor Bugayenko (yegor256@gmail.com) -# Copyright:: Copyright (c) 2018 Zerocracy, Inc. +# Copyright:: Copyright (c) 2018 Yegor Bugayenko # License:: MIT module Zold # Create command class Create def initialize(wallets:, pubkey:, log: Log::Quiet.new) @wallets = wallets @pubkey = pubkey @log = log end - def run - id = Id.new + def run(args = []) + id = args.empty? ? Id.new : Id.new(args[0]) wallet = @wallets.find(id) wallet.init(id, @pubkey) - @log.info("#{wallet} created at #{@wallets}") + @log.info(wallet.id) + @log.debug("Wallet #{Rainbow(wallet).green} \ +created at #{@wallets.path}") wallet end end end