ec2ctl 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ec2ctl/cli.rb +26 -4
- data/lib/ec2ctl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef20c7f1644eb97cc35e3d55f1aae7e368d03423
|
4
|
+
data.tar.gz: b19989f470da8ac2d2fdd43606cecf54bd303668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9d63876e884810227e292d88d80d8258550f9bf1412b64585592b088dc9659a389b198972adac166682829b3d5f5d51725e4b4db066722e856bf649d1287d76
|
7
|
+
data.tar.gz: ed7c9fd3b1ba62892b69b7021fda5eac29a713ed546993eb4e55375192a89d90d402fee64cd856fa0aa5e3ce63b7ddb9cadf9b1414f1aa243c3a62e0a664aff5
|
data/lib/ec2ctl/cli.rb
CHANGED
@@ -44,10 +44,11 @@ module EC2Ctl
|
|
44
44
|
else
|
45
45
|
case options.format
|
46
46
|
when /table/i
|
47
|
-
say
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
say tableize(attributes, instance_infos)
|
48
|
+
when /markdown/i
|
49
|
+
say tableize(attributes, instance_infos, :markdown)
|
50
|
+
when /backlog/i
|
51
|
+
say tableize(attributes, instance_infos, :backlog)
|
51
52
|
when /json/i
|
52
53
|
say JSON.pretty_generate(instance_infos)
|
53
54
|
when /yaml/i
|
@@ -64,6 +65,27 @@ module EC2Ctl
|
|
64
65
|
|
65
66
|
private
|
66
67
|
|
68
|
+
def tableize(attributes, instance_infos, mode = nil)
|
69
|
+
table = Terminal::Table.new(
|
70
|
+
headings: attributes,
|
71
|
+
rows: instance_infos.map {|i| attributes.map {|a| i[a]}}
|
72
|
+
)
|
73
|
+
|
74
|
+
case mode
|
75
|
+
when :markdown
|
76
|
+
lines = table.to_s.lines[1..-2]
|
77
|
+
lines[1].gsub!("+", "|")
|
78
|
+
lines.join
|
79
|
+
when :backlog
|
80
|
+
lines = table.to_s.lines[1..-2]
|
81
|
+
lines[0].sub!("\n", "h\n")
|
82
|
+
lines[1] = nil
|
83
|
+
lines.compact.join
|
84
|
+
else
|
85
|
+
table
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
67
89
|
def client
|
68
90
|
@client
|
69
91
|
end
|
data/lib/ec2ctl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ec2ctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- y13i
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|