googlesheets 0.7.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/shat +19 -5
- data/lib/googlesheets.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e14329dba7ace514cf5f694dd2cd3560c0c4d3519a763817bce352ef1411559c
|
4
|
+
data.tar.gz: 9f050792290e7a7c1317586ff8c3633474d538ad1cb60e5d8274f16cc38ac2da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1aaaa1d70f7695e9d9a3d3b5a04ca24ff894189833bc741d668abd206c61c3677cb51e198f6c4a073819b297ce676bb3c7f29a4c0635d48eeee0c4a9c12ee8a
|
7
|
+
data.tar.gz: 450e3d068618326be503baf436babda07bef675a7067a55d4c44c817524fef3fa48e3b81159ac1cc3b96dbc595e32515a99572f1a69c6b4adbe8445deee40994
|
data/bin/shat
CHANGED
@@ -16,11 +16,16 @@ trap("INT" ) { abort "\n" }
|
|
16
16
|
OptionParser.new.instance_eval do
|
17
17
|
@banner = "usage: #{program_name} [options] <url>"
|
18
18
|
|
19
|
-
on "-f", "--fill"
|
20
|
-
on "-h", "--help"
|
21
|
-
on "-
|
22
|
-
on "-v", "--version"
|
19
|
+
on "-f", "--fill" , "Fill each row with as many cells as the first row"
|
20
|
+
on "-h", "--help" , "Show help and command usage" do Kernel.abort to_s; end
|
21
|
+
on "-s", "--strip" , "Strip leading and trailing whitespace"
|
22
|
+
on "-v", "--version", "Show version number" do Kernel.abort "#{program_name} #{GoogleSheets::VERSION}"; end
|
23
23
|
|
24
|
+
on "--csv" , "Output comma separated data (default)"
|
25
|
+
on "--psv" , "Output pipe separated data"
|
26
|
+
on "--tsv" , "Output tab separated data"
|
27
|
+
|
28
|
+
Kernel.abort to_s if ARGV.empty?
|
24
29
|
self
|
25
30
|
end.parse!(into: opts={}) rescue abort($!.message)
|
26
31
|
|
@@ -28,6 +33,15 @@ fill = opts[:fill]
|
|
28
33
|
link = ARGV.shift or abort("no url provided")
|
29
34
|
trim = opts[:trim]
|
30
35
|
|
36
|
+
# handle separators
|
37
|
+
xcsv = opts[:csv ]
|
38
|
+
xpsv = opts[:psv ]
|
39
|
+
xtsv = opts[:tsv ]
|
40
|
+
hits = [xcsv, xpsv, xtsv].compact.size
|
41
|
+
hits > 1 and abort "only one of csv, psv, or tsv allowed"
|
42
|
+
xcsv = true if hits.zero?
|
43
|
+
seps = xtsv ? "\t" : xpsv ? "|" : ","
|
44
|
+
|
31
45
|
goog = GoogleSheets.new(link)
|
32
46
|
rows = goog.sheet_read
|
33
47
|
rows.each {|cols| cols.map(&:strip!) } if trim
|
@@ -41,4 +55,4 @@ if fill and need = rows[0]&.size
|
|
41
55
|
end
|
42
56
|
end
|
43
57
|
|
44
|
-
Censive.writer {|csv| rows.each {|row| csv << row }}
|
58
|
+
Censive.writer(sep: seps) {|csv| rows.each {|row| csv << row }}
|
data/lib/googlesheets.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googlesheets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|