ec2ctl 0.1.0 → 0.2.0
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/ec2ctl/version.rb +1 -1
- data/lib/ec2ctl.rb +15 -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: 319f5a1aefbfb891cef4f93652d1f77c3daaaf53
|
4
|
+
data.tar.gz: 94d9ddfa009434ecdf7ce25af21dcd13639280df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89bb5114e6463d385d459e9f50645384022311e09aaa76d0a28534840c022be395dcf0c4b4078008f95c69933b15c1444515781992a0088a5b82591710b08112
|
7
|
+
data.tar.gz: 7d6afa61c71790ad5753162cc8cd9352df8b839690f68a1c1b341e30a2659b7b4b84d2fa0924fb497981ce928fa617cd85d8aa1b7ffa79fb4f88656edb0b8673
|
data/lib/ec2ctl/version.rb
CHANGED
data/lib/ec2ctl.rb
CHANGED
@@ -25,12 +25,14 @@ module Ec2ctl
|
|
25
25
|
class_option :profile
|
26
26
|
class_option :color, default: true, type: :boolean
|
27
27
|
|
28
|
+
option :sort, default: name, aliases: [:S]
|
29
|
+
option :limit, type: :numeric, aliases: [:l]
|
28
30
|
desc "list PATTERN", "List all instances in region. Specify PATTERN to filter results by name."
|
29
31
|
def list pattern = ""
|
30
32
|
rows = []
|
31
33
|
|
32
34
|
ec2.instances.each do |instance|
|
33
|
-
name = instance.tags["Name"]
|
35
|
+
name = instance.tags["Name"].to_s
|
34
36
|
next if !pattern.empty? and !name.match pattern
|
35
37
|
|
36
38
|
rows << [
|
@@ -43,6 +45,18 @@ module Ec2ctl
|
|
43
45
|
]
|
44
46
|
end
|
45
47
|
|
48
|
+
col = case options[:sort]
|
49
|
+
when /ID/i then 0
|
50
|
+
when /Name/i then 1
|
51
|
+
when /Type/i then 2
|
52
|
+
when /private/i then 3
|
53
|
+
when /public/i then 4
|
54
|
+
when /status/i then 5
|
55
|
+
end
|
56
|
+
|
57
|
+
rows.sort_by! {|row| row[col].to_s} if col
|
58
|
+
rows = rows[0, options[:limit]] if options[:limit]
|
59
|
+
|
46
60
|
puts Terminal::Table.new headings: ["ID", "Name", "Type", "Private IP", "Public IP", "Status"], rows: rows
|
47
61
|
end
|
48
62
|
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- y13i
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|