uptimerobot_cmd 0.2.1 → 0.3.0

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: 19b3f9fd50af7ef66b911bfa989af841e9153fd4
4
- data.tar.gz: e57daf3be0d59c504e5da45d3807c031a13a1681
3
+ metadata.gz: 5c1b814638e4ab4695ce9a1f7e9e4a60f4cb9772
4
+ data.tar.gz: 2b8b18f1779a9e7e61fd7613d5afe03fc52f5cf2
5
5
  SHA512:
6
- metadata.gz: 915aa203eaa0be52041e1b429d677fd1611ac27ce586eb0a0c306e8e7fb3a0e878e489c4f468db2928c5e24060f8e55df21ae0bc5836ee86819cbf33753b0646
7
- data.tar.gz: 5391d5f0ce19ee2d851bf0d455f5d7b724b369e7e45383cfa83fd0c6f3b67fc90627d18bc3dfc549ff068627bb9b362c8cf0787b47a8c533672ab9d1e177361a
6
+ metadata.gz: 5038c443d74e4d931647e9ba08e4a7b18de4b13080145483c45d5f316b22f77db9b1ed87597428b662f270e6151a91a910aa0ecbfd82dd311c0c986a9f94aa91
7
+ data.tar.gz: 94ec52d591e6ac249845e6cc576a8ff8b7df6b88dd236289505d23d26a15fd1c849d60458f6d54f8bd6d700282c6ead7d9ec9f53deb07d84fb236d84654eb699
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Build Status](https://travis-ci.org/vigo/uptimerobot_cmd.svg?branch=master)](https://travis-ci.org/vigo/uptimerobot_cmd)
2
- ![Version](https://img.shields.io/badge/version-0.2.0-yellow.svg)
2
+ ![Version](https://img.shields.io/badge/version-0.3.0-yellow.svg)
3
3
 
4
4
 
5
5
  # UptimerobotCmd
@@ -72,6 +72,22 @@ uptimerobot_cmd add http://example.com --name="Example Website"
72
72
 
73
73
  Will be more features for **add** soon!
74
74
 
75
+ ### list
76
+
77
+ Output is sorted by **Friendly Name** by default. Use `--sort=` option.
78
+ Valid values are: `name`, `url` and `status`
79
+
80
+ ```bash
81
+ uptimerobot_cmd list
82
+ uptimerobot_cmd list --sort=url
83
+ uptimerobot_cmd list --sort=status
84
+
85
+ # for colorized output
86
+ uptimerobot_cmd list --color
87
+ uptimerobot_cmd list --sort=url --color
88
+ uptimerobot_cmd list --sort=status --color
89
+ ```
90
+
75
91
 
76
92
  ## Development
77
93
 
@@ -12,15 +12,23 @@ module UptimerobotCmd
12
12
  end
13
13
 
14
14
  desc "list", "List current monitors"
15
+ option :sort, default: 'name'
15
16
  long_desc <<-LONGDESC
16
- List current monitored services.\n
17
+ List current monitored services. Output is sorted by friendly name.\n
17
18
 
18
19
  $ uptimerobot_cmd list\n
19
- $ uptimerobot_cmd list --color
20
+ $ uptimerobot_cmd list --color\n
21
+ $ uptimerobot_cmd list --sort=name --color\n
22
+ $ uptimerobot_cmd list --sort=url --color\n
23
+ $ uptimerobot_cmd list --sort=status --color
20
24
  LONGDESC
21
25
  def list
22
26
  ENV['UPTIMEROBOT_COLORIZE'] = '1' if options[:color]
23
- monitors = UptimerobotCmd.get_monitors
27
+ sort_field = 'friendlyname'
28
+ if ['url', 'status'].include?(options[:sort])
29
+ sort_field = options[:sort]
30
+ end
31
+ monitors = UptimerobotCmd.get_monitors.sort_by{ |el| el[sort_field] }
24
32
  table_title = 'Monitoring %d site(s)' % monitors.count
25
33
  puts print_monitors(monitors, table_title)
26
34
  end
@@ -1,3 +1,3 @@
1
1
  module UptimerobotCmd
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uptimerobot_cmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uğur Özyılmazel