lib/zold/commands/calculate.rb in zold-0.13.46 vs lib/zold/commands/calculate.rb in zold-0.14.0
- old
+ new
@@ -33,12 +33,15 @@
@log = log
end
def run(args = [])
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
- o.banner = "Usage: zold push [ID...] [options]
+ o.banner = "Usage: zold score [options]
Available options:"
+ o.string '--time',
+ 'The time to start a score prefix with (default: current time)',
+ default: Time.now.utc.iso8601
o.string '--invoice',
'The invoice you want to collect money to'
o.integer '--port',
"TCP port to open for the Net (default: #{Remotes::PORT})",
default: Remotes::PORT
@@ -69,10 +72,10 @@
start = Time.now
mstart = Time.now
strength = opts[:strength]
raise "Invalid strength: #{strength}" if strength <= 0 || strength > 8
score = Zold::Score.new(
- Time.now, opts[:host], opts[:port].to_i,
+ Time.parse(opts[:time]), opts[:host], opts[:port].to_i,
opts[:invoice], strength: strength
)
loop do
msg = score.to_s
msg += (score.value > 0 ? ' ' + score.hash : '') unless opts['hide-hash']