Class: Zold::Create
- Inherits:
-
Object
- Object
- Zold::Create
- Defined in:
- lib/zold/commands/create.rb
Overview
Create command
Instance Method Summary collapse
- #create(id, _) ⇒ Object
-
#initialize(wallets:, pubkey:, log: Log::Quiet.new) ⇒ Create
constructor
A new instance of Create.
- #run(args = []) ⇒ Object
Constructor Details
Instance Method Details
#create(id, _) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/zold/commands/create.rb', line 51 def create(id, _) wallet = @wallets.find(id) wallet.init(id, @pubkey) @log.info(wallet.id) @log.debug("Wallet #{Rainbow(wallet).green} \ created at #{@wallets.path}") wallet end |
#run(args = []) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/zold/commands/create.rb', line 38 def run(args = []) opts = Slop.parse(args, help: true) do |o| o. = "Usage: zold create [options] Available options:" o.bool '--help', 'Print instructions' end if opts.help? @log.info(opts.to_s) return end create(opts.arguments.empty? ? Id.new : Id.new(opts.arguments[0]), opts) end |