Class: Zold::Merge
- Inherits:
-
Object
- Object
- Zold::Merge
- Includes:
- ThreadBadge
- Defined in:
- lib/zold/commands/merge.rb
Overview
MERGE command
Instance Method Summary collapse
-
#initialize(wallets:, remotes:, copies:, log: Log::NULL) ⇒ Merge
constructor
A new instance of Merge.
-
#run(args = []) ⇒ Object
Returns the array of modified wallets (IDs).
Constructor Details
Instance Method Details
#run(args = []) ⇒ Object
Returns the array of modified wallets (IDs)
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/zold/commands/merge.rb', line 52 def run(args = []) opts = Slop.parse(args, help: true, suppress_errors: true) do |o| o. = "Usage: zold merge [ID...] [options] Available options:" o.bool '--skip-propagate', 'Don\'t propagate after merge', default: false o.bool '--skip-legacy', 'Don\'t make legacy transactions (older than 24 hours) immutable', default: false o.bool '--shallow', 'Don\'t try to pull other wallets if their confirmations are required', default: false o.string '--network', 'The name of the network we work in', default: 'test' o.bool '--help', 'Print instructions' end mine = Args.new(opts, @log).take || return modified = [] list = mine.empty? ? @wallets.all : mine.map { |i| Id.new(i) } list.uniq.each do |id| next unless merge(id, Copies.new(File.join(@copies, id)), opts) modified << id next if opts['skip-propagate'] require_relative 'propagate' modified += Propagate.new(wallets: @wallets, log: @log).run(args) end modified end |