sms-logparser 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sms-logparser/cli.rb +11 -1
- data/lib/sms-logparser/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79fdbf9f1e00638b7f470363cb1a436c49dbf5a6
|
4
|
+
data.tar.gz: 59d6c29aa01ffbbb31c4b8924f4c8ccc6ac3faac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ff73068b045081b7a9ed360092c78a018ace25629eb4cf10f7fa76d531e64deea495da3ba308ec049face623b3972bc83d2614fcc26fecef3088218092b82a4
|
7
|
+
data.tar.gz: 2ea9ba98dc42185dfe262d7ff9e4d4c577d6b49af911550b2edd2cb57402ef7a4ebababe829024085a2bd7aa17b21b017f32556c61bac469c0fee1e9d517862b
|
data/lib/sms-logparser/cli.rb
CHANGED
@@ -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
|
-
|
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.
|
3
|
-
end
|
2
|
+
VERSION = "0.9.6"
|
3
|
+
end
|