sms-logparser 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc77b7cf3d277b4dba9c5a55772e9e8cf07b6dcc
4
- data.tar.gz: 209eb3e9b406a44236b3e86fcda7b31f34420b26
3
+ metadata.gz: 79fdbf9f1e00638b7f470363cb1a436c49dbf5a6
4
+ data.tar.gz: 59d6c29aa01ffbbb31c4b8924f4c8ccc6ac3faac
5
5
  SHA512:
6
- metadata.gz: 7efbc73f000ad3c9355bb6f7ba13ae6d842638893ceab8ae9ceea27aab0df2fd07a87ac6b96a2f3e526b35834110cf32ea60a0431158824806217ac6c3ae4103
7
- data.tar.gz: 541f1386c86c279f5fc22bf526acca5f19511f87b124ee2c005f1b61ebf9b9ad7f55935aff37f93216ce5430ef398bd661e031265fc69d2e7be76967b7399caf
6
+ metadata.gz: 1ff73068b045081b7a9ed360092c78a018ace25629eb4cf10f7fa76d531e64deea495da3ba308ec049face623b3972bc83d2614fcc26fecef3088218092b82a4
7
+ data.tar.gz: 2ea9ba98dc42185dfe262d7ff9e4d4c577d6b49af911550b2edd2cb57402ef7a4ebababe829024085a2bd7aa17b21b017f32556c61bac469c0fee1e9d517862b
@@ -89,6 +89,8 @@ module SmsLogparser
89
89
  desc "history", "List the last paser runs"
90
90
  option :results, type: :numeric, default: 10, aliases: %w(-n),
91
91
  desc: "Number of results to display"
92
+ option :format, type: :string, default: 'table', aliases: %w(-f),
93
+ desc: "Output format [table|csv]"
92
94
  def history
93
95
  runs = Mysql.new(options).last_runs(options[:results])
94
96
  if runs && runs.size > 0
@@ -103,7 +105,9 @@ module SmsLogparser
103
105
  "#{run['run_time']}s"
104
106
  ]
105
107
  end
106
- print_table table
108
+ options[:format] == 'csv' ?
109
+ table_to_csv(table) :
110
+ print_table(table)
107
111
  else
108
112
  say "No parser runs found in the database."
109
113
  end
@@ -143,6 +147,12 @@ module SmsLogparser
143
147
  }
144
148
  end
145
149
 
150
+ def table_to_csv(table)
151
+ table.each do |line|
152
+ puts line.join(',')
153
+ end
154
+ end
155
+
146
156
  def log_parse_results(res)
147
157
  res = res.reject {|k,v| %w(:id :run_at).include? k}
148
158
  message = "Parser #{options[:simulate] ? 'simulation' : 'run'} ended."
@@ -1,3 +1,3 @@
1
1
  module SmsLogparser
2
- VERSION = "0.9.5"
3
- end
2
+ VERSION = "0.9.6"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sms-logparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - niwo