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 +4 -4
- data/README.md +17 -1
- data/lib/uptimerobot_cmd/cli.rb +11 -3
- data/lib/uptimerobot_cmd/version.rb +1 -1
- 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: 5c1b814638e4ab4695ce9a1f7e9e4a60f4cb9772
|
4
|
+
data.tar.gz: 2b8b18f1779a9e7e61fd7613d5afe03fc52f5cf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
![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
|
|
data/lib/uptimerobot_cmd/cli.rb
CHANGED
@@ -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
|
-
|
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
|