Class: Zold::Clean
- Inherits:
-
Object
- Object
- Zold::Clean
- Defined in:
- lib/zold/commands/clean.rb
Overview
CLEAN command
Instance Method Summary collapse
- #clean(cps, _) ⇒ Object
-
#initialize(wallets:, copies:, log: Log::Quiet.new) ⇒ Clean
constructor
A new instance of Clean.
- #run(args = []) ⇒ Object
Constructor Details
Instance Method Details
#clean(cps, _) ⇒ Object
58 59 60 61 62 |
# File 'lib/zold/commands/clean.rb', line 58 def clean(cps, _) cps.clean @log.debug("Expired local copies removed for #{cps}, \ #{cps.all.count} left") end |
#run(args = []) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/zold/commands/clean.rb', line 45 def run(args = []) opts = Slop.parse(args, help: true, suppress_errors: true) do |o| o. = "Usage: zold clean [ID...] [options] Available options:" o.bool '--help', 'Print instructions' end mine = Args.new(opts, @log).take || return mine = @wallets.all if mine.empty? mine.each do |id| clean(Copies.new(File.join(@copies, id)), opts) end end |