lib/capwatch/cli.rb in capwatch-0.1.13 vs lib/capwatch/cli.rb in capwatch-0.2.0
- old
+ new
@@ -1,21 +1,25 @@
-require 'optparse'
-require 'ostruct'
+# frozen_string_literal: true
+require "optparse"
+require "ostruct"
+
module Capwatch
class CLI
+
def self.parse(args)
options = OpenStruct.new
options.tick = 60 * 5
opt_parser = OptionParser.new do |opts|
- opts.on('-t', '--tick [Integer]', Integer, 'Tick Interval') do |t|
+ opts.on("-t", "--tick [Integer]", Integer, "Tick Interval") do |t|
options.tick = t
end
- opts.on('-e', '--telegram-token=', String) do |val|
+ opts.on("-e", "--telegram-token=", String) do |val|
options.telegram = val
end
end
opt_parser.parse!(args)
options
end
+
end
end